@@ -86,7 +86,7 @@ def assertCacheWorksForUser(
86
86
self .assertNotEqual (0 , len (accounts ))
87
87
account = accounts [0 ]
88
88
if ("scope" not in result_from_wire # This is the usual case
89
- or # Authority server could reject some scopes
89
+ or # Authority server could return different set of scopes
90
90
set (scope ) <= set (result_from_wire ["scope" ].split (" " ))
91
91
):
92
92
# Going to test acquire_token_silent(...) to locate an AT from cache
@@ -115,7 +115,7 @@ def assertCacheWorksForUser(
115
115
# result_from_wire['access_token'] != result_from_cache['access_token']
116
116
# but ROPC in B2C tends to return the same AT we obtained seconds ago.
117
117
# Now looking back, "refresh_token grant would return a brand new AT"
118
- # was just an empirical observation but never a committment in specs,
118
+ # was just an empirical observation but never a commitment in specs,
119
119
# so we adjust our way to assert here.
120
120
(result_from_cache or {}).get ("access_token" ),
121
121
"We should get an AT from acquire_token_silent(...) call" )
@@ -683,9 +683,18 @@ def test_adfs2019_onprem_acquire_token_interactive(self):
683
683
config ["authority" ] = "https://fs.%s.com/adfs" % config ["lab_name" ]
684
684
config ["scope" ] = self .adfs2019_scopes
685
685
config ["port" ] = 8080
686
- self ._test_acquire_token_interactive (
687
- username_uri = "https://msidlab.com/api/user?usertype=onprem&federationprovider=ADFSv2019" ,
688
- ** config )
686
+ username_uri = "https://msidlab.com/api/user?usertype=onprem&federationprovider=ADFSv2019"
687
+ try :
688
+ import pymsalruntime
689
+ logger .warning ("Absorbing an AssertionError because PyMsalRuntime does not yet support onprem ADFS" )
690
+ with self .assertRaises (AssertionError ): # Expecting a failure because
691
+ # PyMsalRuntime does not yet support on-prem ADFS.
692
+ # But if this expectation is not met,
693
+ # it would mean the latest PyMsalRuntime supports onprem ADFS.
694
+ # At that time we would revert this patch.
695
+ self ._test_acquire_token_interactive (username_uri = username_uri , ** config )
696
+ except ImportError : # Then use browser-based interactive flow, which will work
697
+ self ._test_acquire_token_interactive (username_uri = username_uri , ** config )
689
698
690
699
@unittest .skipUnless (
691
700
os .getenv ("LAB_OBO_CLIENT_SECRET" ),
0 commit comments