Another rails test fix.
authorWard Vandewege <ward@curii.com>
Thu, 28 Oct 2021 18:10:40 +0000 (14:10 -0400)
committerWard Vandewege <ward@curii.com>
Thu, 28 Oct 2021 18:10:40 +0000 (14:10 -0400)
refs #18183

Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

services/api/test/integration/users_test.rb

index 81168e15b7b43b134036717bbe9f427b9f0de0be..f3e787e3dffc6ed01570b249865068f1ecfacb7e 100644 (file)
@@ -434,20 +434,26 @@ class UsersTest < ActionDispatch::IntegrationTest
         params: {},
         headers: {"HTTP_AUTHORIZATION" => "Bearer #{token}"})
     assert_response(:success)
-    user = json_response
-    assert_equal true, user['is_active']
+    userJSON = json_response
+    assert_equal true, userJSON['is_active']
 
     post("/arvados/v1/users/#{user['uuid']}/unsetup",
         params: {},
         headers: auth(:admin))
     assert_response :success
 
+    # Need to get a new token, the old one was invalidated by the unsetup call
+    act_as_system_user do
+      ap = ApiClientAuthorization.create!(user: user, api_client_id: 0)
+      token = ap.api_token
+    end
+
     get("/arvados/v1/users/#{user['uuid']}",
         params: {},
         headers: {"HTTP_AUTHORIZATION" => "Bearer #{token}"})
     assert_response(:success)
-    user = json_response
-    assert_equal false, user['is_active']
+    userJSON = json_response
+    assert_equal false, userJSON['is_active']
 
     post("/arvados/v1/users/#{user['uuid']}/activate",
         params: {},