15954: Fix test.
authorTom Clegg <tom@tomclegg.ca>
Thu, 27 Feb 2020 16:58:48 +0000 (11:58 -0500)
committerTom Clegg <tom@tomclegg.ca>
Thu, 27 Feb 2020 16:58:48 +0000 (11:58 -0500)
The following "setup user" call was only succeeding because the "uuid"
param was being ignored and the call was processed as a no-op ("admin
account is already set up, nothing to do").

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@tomclegg.ca>

services/api/test/integration/users_test.rb

index ee230d5140071c2c8cf5ae1dd961fe8663f115b2..4be89a24552eab1d6847fcd525dcf2a6bc7ea561 100644 (file)
@@ -326,7 +326,7 @@ class UsersTest < ActionDispatch::IntegrationTest
 
   end
 
-  test "cannot set is_activate to false directly" do
+  test "cannot set is_active to false directly" do
     post('/arvados/v1/users',
       params: {
         user: {
@@ -339,6 +339,14 @@ class UsersTest < ActionDispatch::IntegrationTest
     user = json_response
     assert_equal false, user['is_active']
 
+    token = act_as_system_user do
+      ApiClientAuthorization.create!(user: User.find_by_uuid(user['uuid']), api_client: ApiClient.all.first).api_token
+    end
+    post("/arvados/v1/user_agreements/sign",
+        params: {uuid: 'zzzzz-4zz18-t68oksiu9m80s4y'},
+        headers: {"HTTP_AUTHORIZATION" => "Bearer #{token}"})
+    assert_response :success
+
     post("/arvados/v1/users/#{user['uuid']}/activate",
       params: {},
       headers: auth(:admin))