6
6
# JavaClientApiTest.testImpersonationConnection()
7
7
8
8
pytestmark = pytest .mark .integration # Mark all tests in this module as integration tests
9
- TEST_EMAIL = "test_user@test.test "
9
+ TEST_EMAIL = "test_user@example.com "
10
10
TEST_DISPLAY_NAME = "test user"
11
+ DEACTIVATED_EMAIL = "[email protected] "
12
+ DEACTIVATED_DISPLAY_NAME = "deactivated user"
11
13
12
14
13
15
@pytest .fixture (scope = "session" )
@@ -17,7 +19,7 @@ def test_user(api: APIWrapper, project):
17
19
user_id = resp ["userId" ]
18
20
yield {"id" : user_id , "email" : TEST_EMAIL , "display_name" : TEST_DISPLAY_NAME }
19
21
url = api .server_context .build_url ("security" , "deleteUser.api" , container_path = "/" )
20
- resp = api .server_context .make_request (url , {"id" : user_id })
22
+ api .server_context .make_request (url , {"id" : user_id })
21
23
22
24
23
25
def test_impersonation (api : APIWrapper , test_user ):
@@ -44,3 +46,22 @@ def test_impersonation(api: APIWrapper, test_user):
44
46
45
47
# We need to stop impersonating a user before leaving so we don't mess up other tests.
46
48
api .security .stop_impersonating ()
49
+
50
+
51
+ @pytest .fixture (scope = "module" )
52
+ def deactivated_user (api : APIWrapper , project ):
53
+ url = api .server_context .build_url ("security" , "createNewUser.api" )
54
+ resp = api .server_context .make_request (url , {"email" : DEACTIVATED_EMAIL , "sendEmail" : False })
55
+ user_id = resp ["userId" ]
56
+ yield {"id" : user_id , "email" : DEACTIVATED_EMAIL , "display_name" : DEACTIVATED_DISPLAY_NAME }
57
+ url = api .server_context .build_url ("security" , "deleteUser.api" , container_path = "/" )
58
+ api .server_context .make_request (url , {"id" : user_id })
59
+
60
+
61
+ def test_issue_52904 (api : APIWrapper , deactivated_user ):
62
+ resp = api .security .deactivate_users (target_ids = [deactivated_user ["id" ]])
63
+ assert resp ["success" ] is True
64
+
65
+ # Deactivating again shouldn't issue a redirect
66
+ resp = api .security .deactivate_users (target_ids = [deactivated_user ["id" ]])
67
+ assert resp ["success" ] is True
0 commit comments