@@ -258,7 +258,7 @@ def test_ssh_cert_for_user(self):
258
258
259
259
@unittest .skipUnless (
260
260
msal .application ._is_running_in_cloud_shell (),
261
- "Manually run this by python -m unittest tests.test_e2e.SshCertTestCase " )
261
+ "Manually run this test case from inside Cloud Shell " )
262
262
def test_ssh_cert_for_user_silent_inside_cloud_shell (self ):
263
263
app = msal .PublicClientApplication ("client_id_wont_matter" )
264
264
accounts = app .get_accounts ()
@@ -270,6 +270,23 @@ def test_ssh_cert_for_user_silent_inside_cloud_shell(self):
270
270
self .assertIsNotNone (result .get ("access_token" ))
271
271
272
272
273
+ @unittest .skipUnless (
274
+ msal .application ._is_running_in_cloud_shell (),
275
+ "Manually run this test case from inside Cloud Shell" )
276
+ class CloudShellTestCase (E2eTestCase ):
277
+ app = msal .PublicClientApplication ("client_id_wont_matter" )
278
+ # Scopes came from https://msazure.visualstudio.com/One/_git/compute-CloudShell?path=/src/images/agent/env/envconfig.PROD.json&version=GBmaster&_a=contents
279
+ scope_that_requires_no_managed_device = "https://management.core.windows.net/"
280
+ def test_access_token_should_be_obtained_for_a_supported_scope (self ):
281
+ accounts = self .app .get_accounts ()
282
+ self .assertNotEqual ([], accounts )
283
+ result = self .app .acquire_token_silent_with_error (
284
+ [self .scope_that_requires_no_managed_device ], account = accounts [0 ])
285
+ self .assertEqual (
286
+ "Bearer" , result .get ("token_type" ), "Unexpected result: %s" % result )
287
+ self .assertIsNotNone (result .get ("access_token" ))
288
+
289
+
273
290
THIS_FOLDER = os .path .dirname (__file__ )
274
291
CONFIG = os .path .join (THIS_FOLDER , "config.json" )
275
292
@unittest .skipUnless (os .path .exists (CONFIG ), "Optional %s not found" % CONFIG )
0 commit comments