Merge branch '10557-auto-setup'
[arvados.git] / services / api / test / functional / arvados / v1 / users_controller_test.rb
index f98e482dd84a190fb08f3e606be45835119f986f..789242f6e02e9080790f2e37f52d8040df1f8ac1 100644 (file)
@@ -660,6 +660,24 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     assert (setup_email.body.to_s.include? "#{Rails.configuration.workbench_address}users/#{created['uuid']}/virtual_machines"), 'Expected virtual machines url in email body'
   end
 
+  test "setup inactive user by changing is_active to true" do
+    authorize_with :admin
+    active_user = users(:active)
+
+    # invoke setup with a repository
+    put :update, {
+          id: active_user['uuid'],
+          user: {
+            is_active: true,
+          }
+        }
+    assert_response :success
+    assert_equal active_user['uuid'], json_response['uuid']
+    updated = User.where(uuid: active_user['uuid']).first
+    assert_equal(true, updated.is_active)
+    assert_equal({read: true}, updated.group_permissions[all_users_group_uuid])
+  end
+
   test "non-admin user can get basic information about readable users" do
     authorize_with :spectator
     get(:index)