@@ -165,7 +165,7 @@ def test_sign_in(self):
165165 network_resp .json .return_value = json .loads ("""{"jwt": "response"}""" )
166166 mock_post .return_value = network_resp
167167 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 } "
169169 mock_post .assert_called_with (
170170 expected_uri ,
171171 headers = {
@@ -204,7 +204,7 @@ def test_sign_up(self):
204204 network_resp .json .return_value = json .loads ("""{"jwt": "response"}""" )
205205 mock_post .return_value = network_resp
206206 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 } "
208208 mock_post .assert_called_with (
209209 expected_uri ,
210210 headers = {
@@ -253,7 +253,7 @@ def test_sign_up_or_in(self):
253253 network_resp .json .return_value = json .loads ("""{"jwt": "response"}""" )
254254 mock_post .return_value = network_resp
255255 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 } "
257257 mock_post .assert_called_with (
258258 expected_uri ,
259259 headers = {
@@ -283,3 +283,32 @@ def test_sign_up_or_in(self):
283283 params = None ,
284284 timeout = DEFAULT_TIMEOUT_SECONDS ,
285285 )
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