16989: Add test to sync is_invited
authorPeter Amstutz <peter.amstutz@curii.com>
Fri, 9 Oct 2020 16:26:04 +0000 (12:26 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Fri, 9 Oct 2020 16:26:04 +0000 (12:26 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

services/api/test/integration/remote_user_test.rb

index 9ad93c2ee6af4f3cb6a6a42f10e85468b90e8946..d3180e173f6b6b8bff72754c98dc5e508b67d031 100644 (file)
@@ -348,7 +348,30 @@ class RemoteUsersTest < ActionDispatch::IntegrationTest
     assert_equal 'barney', json_response['username']
   end
 
-    test 'get active user from Login cluster when AutoSetupNewUsers is set' do
+  test 'get invited by inactive user from Login cluster when AutoSetupNewUsers is set' do
+    Rails.configuration.Login.LoginCluster = 'zbbbb'
+    Rails.configuration.Users.AutoSetupNewUsers = true
+    @stub_content = {
+      uuid: 'zbbbb-tpzed-000000000000001',
+      email: 'foo@example.com',
+      username: 'barney',
+      is_admin: false,
+      is_active: false,
+      is_invited: true,
+    }
+    get '/arvados/v1/users/current',
+      params: {format: 'json'},
+      headers: auth(remote: 'zbbbb')
+    assert_response :success
+    assert_equal 'zbbbb-tpzed-000000000000001', json_response['uuid']
+    assert_equal false, json_response['is_admin']
+    assert_equal false, json_response['is_active']
+    assert_equal true, json_response['is_invited']
+    assert_equal 'foo@example.com', json_response['email']
+    assert_equal 'barney', json_response['username']
+  end
+
+  test 'get active user from Login cluster when AutoSetupNewUsers is set' do
     Rails.configuration.Login.LoginCluster = 'zbbbb'
     Rails.configuration.Users.AutoSetupNewUsers = true
     @stub_content = {