@@ -2419,7 +2419,9 @@ def test_generate_sign_up_embedded_link(self):
24192419 with patch ("requests.post" ) as mock_post :
24202420 mock_post .return_value .ok = False
24212421 self .assertRaises (
2422- AuthException , self .client .mgmt .user .generate_sign_up_embedded_link , "login-id"
2422+ AuthException ,
2423+ self .client .mgmt .user .generate_sign_up_embedded_link ,
2424+ "login-id" ,
24232425 )
24242426
24252427 # Test success flow
@@ -2519,3 +2521,73 @@ def test_history(self):
25192521 params = None ,
25202522 timeout = DEFAULT_TIMEOUT_SECONDS ,
25212523 )
2524+
2525+ def test_update_test_user (self ):
2526+ with patch ("requests.post" ) as mock_post :
2527+ network_resp = mock .Mock ()
2528+ network_resp .ok = True
2529+ network_resp .json .return_value = json .loads ('{"user": {"id": "u1"}}' )
2530+ mock_post .return_value = network_resp
2531+ resp = self .client .mgmt .user .update (
2532+ "id" ,
2533+ display_name = "test-user" ,
2534+ test = True ,
2535+ )
2536+ user = resp ["user" ]
2537+ self .assertEqual (user ["id" ], "u1" )
2538+ mock_post .assert_called_with (
2539+ f"{ common .DEFAULT_BASE_URL } { MgmtV1 .user_update_path } " ,
2540+ headers = {
2541+ ** common .default_headers ,
2542+ "Authorization" : f"Bearer { self .dummy_project_id } :{ self .dummy_management_key } " ,
2543+ "x-descope-project-id" : self .dummy_project_id ,
2544+ },
2545+ params = None ,
2546+ json = {
2547+ "loginId" : "id" ,
2548+ "email" : None ,
2549+ "phone" : None ,
2550+ "displayName" : "test-user" ,
2551+ "roleNames" : [],
2552+ "userTenants" : [],
2553+ "test" : True ,
2554+ "picture" : None ,
2555+ "customAttributes" : None ,
2556+ "additionalLoginIds" : None ,
2557+ "ssoAppIDs" : None ,
2558+ },
2559+ allow_redirects = False ,
2560+ verify = True ,
2561+ timeout = DEFAULT_TIMEOUT_SECONDS ,
2562+ )
2563+
2564+ def test_patch_test_user (self ):
2565+ with patch ("requests.patch" ) as mock_patch :
2566+ network_resp = mock .Mock ()
2567+ network_resp .ok = True
2568+ network_resp .json .return_value = json .loads ('{"user": {"id": "u1"}}' )
2569+ mock_patch .return_value = network_resp
2570+ resp = self .client .mgmt .user .patch (
2571+ "id" ,
2572+ display_name = "test-user" ,
2573+ test = True ,
2574+ )
2575+ user = resp ["user" ]
2576+ self .assertEqual (user ["id" ], "u1" )
2577+ mock_patch .assert_called_with (
2578+ f"{ common .DEFAULT_BASE_URL } { MgmtV1 .user_patch_path } " ,
2579+ headers = {
2580+ ** common .default_headers ,
2581+ "Authorization" : f"Bearer { self .dummy_project_id } :{ self .dummy_management_key } " ,
2582+ "x-descope-project-id" : self .dummy_project_id ,
2583+ },
2584+ params = None ,
2585+ json = {
2586+ "loginId" : "id" ,
2587+ "displayName" : "test-user" ,
2588+ "test" : True ,
2589+ },
2590+ allow_redirects = False ,
2591+ verify = True ,
2592+ timeout = DEFAULT_TIMEOUT_SECONDS ,
2593+ )
0 commit comments