@@ -75,19 +75,35 @@ def test_cache_empty_will_be_returned_as_None(self):
75
75
self .assertEqual (
76
76
None , self .app .acquire_token_silent_with_error (['cache_miss' ], self .account ))
77
77
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
+
78
85
def test_acquire_token_silent_with_error_will_return_error (self ):
79
86
error_response = {"error" : "invalid_grant" , "error_description" : "xyz" }
80
87
def tester (url , ** kwargs ):
81
88
return Mock (status_code = 400 , json = Mock (return_value = error_response ))
82
89
self .assertEqual (error_response , self .app .acquire_token_silent_with_error (
83
90
self .scopes , self .account , post = tester ))
84
91
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 " }
87
94
def tester (url , ** kwargs ):
88
95
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" ))
91
107
92
108
class TestClientApplicationAcquireTokenSilentFociBehaviors (unittest .TestCase ):
93
109
0 commit comments