@@ -75,19 +75,35 @@ def test_cache_empty_will_be_returned_as_None(self):
7575 self .assertEqual (
7676 None , self .app .acquire_token_silent_with_error (['cache_miss' ], self .account ))
7777
78+ def test_acquire_token_silent_will_suppress_error (self ):
79+ error_response = {"error" : "invalid_grant" , "suberror" : "xyz" }
80+ def tester (url , ** kwargs ):
81+ return Mock (status_code = 400 , json = Mock (return_value = error_response ))
82+ self .assertEqual (None , self .app .acquire_token_silent (
83+ self .scopes , self .account , post = tester ))
84+
7885 def test_acquire_token_silent_with_error_will_return_error (self ):
7986 error_response = {"error" : "invalid_grant" , "error_description" : "xyz" }
8087 def tester (url , ** kwargs ):
8188 return Mock (status_code = 400 , json = Mock (return_value = error_response ))
8289 self .assertEqual (error_response , self .app .acquire_token_silent_with_error (
8390 self .scopes , self .account , post = tester ))
8491
85- def test_acquire_token_silent_will_suppress_error (self ):
86- error_response = {"error" : "invalid_grant" , "error_description " : "xyz " }
92+ def test_atswe_will_map_some_suberror_to_classification_as_is (self ):
93+ error_response = {"error" : "invalid_grant" , "suberror " : "basic_action " }
8794 def tester (url , ** kwargs ):
8895 return Mock (status_code = 400 , json = Mock (return_value = error_response ))
89- self .assertEqual (None , self .app .acquire_token_silent (
90- self .scopes , self .account , post = tester ))
96+ result = self .app .acquire_token_silent_with_error (
97+ self .scopes , self .account , post = tester )
98+ self .assertEqual ("basic_action" , result .get ("classification" ))
99+
100+ def test_atswe_will_map_some_suberror_to_classification_to_empty_string (self ):
101+ error_response = {"error" : "invalid_grant" , "suberror" : "client_mismatch" }
102+ def tester (url , ** kwargs ):
103+ return Mock (status_code = 400 , json = Mock (return_value = error_response ))
104+ result = self .app .acquire_token_silent_with_error (
105+ self .scopes , self .account , post = tester )
106+ self .assertEqual ("" , result .get ("classification" ))
91107
92108class TestClientApplicationAcquireTokenSilentFociBehaviors (unittest .TestCase ):
93109
0 commit comments