@@ -133,6 +133,11 @@ def assertCacheWorksForApp(self, result_from_wire, scope):
133
133
self .assertEqual (
134
134
result_from_wire ['access_token' ], result_from_cache ['access_token' ],
135
135
"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
136
141
137
142
def _test_username_password (self ,
138
143
authority = None , client_id = None , username = None , password = None , scope = None ,
@@ -618,11 +623,12 @@ def _test_acquire_token_by_client_secret(
618
623
self , client_id = None , client_secret = None , authority = None , scope = None ,
619
624
** ignored ):
620
625
assert client_id and client_secret and authority and scope
621
- app = msal .ConfidentialClientApplication (
626
+ self . app = msal .ConfidentialClientApplication (
622
627
client_id , client_credential = client_secret , authority = authority ,
623
628
http_client = MinimalHttpClient ())
624
- result = app .acquire_token_for_client (scope )
629
+ result = self . app .acquire_token_for_client (scope )
625
630
self .assertIsNotNone (result .get ("access_token" ), "Got %s instead" % result )
631
+ self .assertCacheWorksForApp (result , scope )
626
632
627
633
628
634
class WorldWideTestCase (LabBasedTestCase ):
0 commit comments