@@ -165,7 +165,7 @@ def test_sign_in(self):
165
165
network_resp .json .return_value = json .loads ("""{"jwt": "response"}""" )
166
166
mock_post .return_value = network_resp
167
167
client .mgmt .jwt .sign_in ("loginId" )
168
- expected_uri = f"{ common .DEFAULT_BASE_URL } { MgmtV1 .mgmt_sign_in } "
168
+ expected_uri = f"{ common .DEFAULT_BASE_URL } { MgmtV1 .mgmt_sign_in_path } "
169
169
mock_post .assert_called_with (
170
170
expected_uri ,
171
171
headers = {
@@ -204,7 +204,7 @@ def test_sign_up(self):
204
204
network_resp .json .return_value = json .loads ("""{"jwt": "response"}""" )
205
205
mock_post .return_value = network_resp
206
206
client .mgmt .jwt .sign_up ("loginId" )
207
- expected_uri = f"{ common .DEFAULT_BASE_URL } { MgmtV1 .mgmt_sign_up } "
207
+ expected_uri = f"{ common .DEFAULT_BASE_URL } { MgmtV1 .mgmt_sign_up_path } "
208
208
mock_post .assert_called_with (
209
209
expected_uri ,
210
210
headers = {
@@ -253,7 +253,7 @@ def test_sign_up_or_in(self):
253
253
network_resp .json .return_value = json .loads ("""{"jwt": "response"}""" )
254
254
mock_post .return_value = network_resp
255
255
client .mgmt .jwt .sign_up_or_in ("loginId" )
256
- expected_uri = f"{ common .DEFAULT_BASE_URL } { MgmtV1 .mgmt_sign_up_or_in } "
256
+ expected_uri = f"{ common .DEFAULT_BASE_URL } { MgmtV1 .mgmt_sign_up_or_in_path } "
257
257
mock_post .assert_called_with (
258
258
expected_uri ,
259
259
headers = {
@@ -283,3 +283,32 @@ def test_sign_up_or_in(self):
283
283
params = None ,
284
284
timeout = DEFAULT_TIMEOUT_SECONDS ,
285
285
)
286
+
287
+ def test_anonymous (self ):
288
+ client = DescopeClient (
289
+ self .dummy_project_id ,
290
+ self .public_key_dict ,
291
+ False ,
292
+ self .dummy_management_key ,
293
+ )
294
+
295
+ # Test success flow
296
+ with patch ("requests.post" ) as mock_post :
297
+ network_resp = mock .Mock ()
298
+ network_resp .ok = True
299
+ network_resp .json .return_value = json .loads ("""{"jwt": "response"}""" )
300
+ mock_post .return_value = network_resp
301
+ client .mgmt .jwt .anonymous ({"k1" : "v1" }, "id" )
302
+ expected_uri = f"{ common .DEFAULT_BASE_URL } { MgmtV1 .anonymous_path } "
303
+ mock_post .assert_called_with (
304
+ expected_uri ,
305
+ headers = {
306
+ ** common .default_headers ,
307
+ "Authorization" : f"Bearer { self .dummy_project_id } :{ self .dummy_management_key } " ,
308
+ },
309
+ json = {"customClaims" : {"k1" : "v1" }, "selectedTenant" : "id" },
310
+ allow_redirects = False ,
311
+ verify = True ,
312
+ params = None ,
313
+ timeout = DEFAULT_TIMEOUT_SECONDS ,
314
+ )
0 commit comments