@@ -133,6 +133,11 @@ def assertCacheWorksForApp(self, result_from_wire, scope):
133133 self .assertEqual (
134134 result_from_wire ['access_token' ], result_from_cache ['access_token' ],
135135 "We should get a cached AT" )
136+ self .app .acquire_token_silent (
137+ # Result will typically be None, because client credential grant returns no RT.
138+ # But we care more on this call should succeed without exception.
139+ scope , account = None ,
140+ force_refresh = True ) # Mimic the AT already expires
136141
137142 def _test_username_password (self ,
138143 authority = None , client_id = None , username = None , password = None , scope = None ,
@@ -618,11 +623,12 @@ def _test_acquire_token_by_client_secret(
618623 self , client_id = None , client_secret = None , authority = None , scope = None ,
619624 ** ignored ):
620625 assert client_id and client_secret and authority and scope
621- app = msal .ConfidentialClientApplication (
626+ self . app = msal .ConfidentialClientApplication (
622627 client_id , client_credential = client_secret , authority = authority ,
623628 http_client = MinimalHttpClient ())
624- result = app .acquire_token_for_client (scope )
629+ result = self . app .acquire_token_for_client (scope )
625630 self .assertIsNotNone (result .get ("access_token" ), "Got %s instead" % result )
631+ self .assertCacheWorksForApp (result , scope )
626632
627633
628634class WorldWideTestCase (LabBasedTestCase ):
0 commit comments