[ARVADOS] updated: 15902f15dc95b9ecb0e0193f9bcdc437fb4fe6f9

git at public.curoverse.com git at public.curoverse.com
Thu Sep 25 10:23:25 EDT 2014


Summary of changes:
 .../functional/arvados/v1/users_controller_test.rb | 85 +++++++++-------------
 1 file changed, 34 insertions(+), 51 deletions(-)

       via  15902f15dc95b9ecb0e0193f9bcdc437fb4fe6f9 (commit)
       via  7943691e146fecc929f1dcde2f794ab32fadc565 (commit)
      from  c5ac04b90cb26e49efb16b322d82913eae2ef423 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 15902f15dc95b9ecb0e0193f9bcdc437fb4fe6f9
Author: radhika <radhika at curoverse.com>
Date:   Thu Sep 25 09:54:11 2014 -0400

    3889: update the test "non-admin user can limit index" to perform the limit check in two tests rather than twice in one test.

diff --git a/services/api/test/functional/arvados/v1/users_controller_test.rb b/services/api/test/functional/arvados/v1/users_controller_test.rb
index 55b9671..531f8e2 100644
--- a/services/api/test/functional/arvados/v1/users_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/users_controller_test.rb
@@ -671,14 +671,14 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     check_non_admin_show
   end
 
-  test "non-admin user can limit index" do
-    g = act_as_system_user do
-      create :group
-    end
-    users = create_list :active_user, 4, join_groups: [g]
-    token = create :token, user: users[0]
+  [2, 4].each do |limit|
+    test "non-admin user can limit index to #{limit}" do
+      g = act_as_system_user do
+        create :group
+      end
+      users = create_list :active_user, 4, join_groups: [g]
+      token = create :token, user: users[0]
 
-    [2, 4].each do |limit|
       authorize_with_token token
       get(:index, limit: limit)
       check_non_admin_index

commit 7943691e146fecc929f1dcde2f794ab32fadc565
Author: radhika <radhika at curoverse.com>
Date:   Thu Sep 25 09:46:50 2014 -0400

    3889: split the test "setup user in multiple steps and verify response" into multiple tests invoking setup on active user,
    rather than perform three setup actions in one test.

diff --git a/services/api/test/functional/arvados/v1/users_controller_test.rb b/services/api/test/functional/arvados/v1/users_controller_test.rb
index f46b702..55b9671 100644
--- a/services/api/test/functional/arvados/v1/users_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/users_controller_test.rb
@@ -305,7 +305,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     verify_num_links @all_links_at_start, 5
   end
 
-  test "setup user with valid email, no vm and repo as input" do
+  test "setup user with valid email, no vm and no repo as input" do
     authorize_with :admin
 
     post :setup, {
@@ -321,6 +321,18 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
 
     # three extra links; system_group, login, and group
     verify_num_links @all_links_at_start, 3
+
+    verify_link response_items, 'arvados#user', true, 'permission', 'can_login',
+        response_object['uuid'], response_object['email'], 'arvados#user', false, 'User'
+
+    verify_link response_items, 'arvados#group', true, 'permission', 'can_read',
+        'All users', response_object['uuid'], 'arvados#group', true, 'Group'
+
+    verify_link response_items, 'arvados#repository', false, 'permission', 'can_manage',
+        'test_repo', response_object['uuid'], 'arvados#repository', true, 'Repository'
+
+    verify_link response_items, 'arvados#virtualMachine', false, 'permission', 'can_login',
+        nil, response_object['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
   end
 
   test "setup user with email, first name, repo name and vm uuid" do
@@ -500,44 +512,14 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
           'Expected Forbidden error'
   end
 
-  test "setup user in multiple steps and verify response" do
+  test "setup active user with repo and no vm" do
     authorize_with :admin
+    active_user = users(:active)
 
+    # invoke setup with a repository
     post :setup, {
-      openid_prefix: 'http://www.example.com/account',
-      user: {
-        email: "foo at example.com"
-      }
-    }
-
-    assert_response :success
-    response_items = JSON.parse(@response.body)['items']
-    created = find_obj_in_resp response_items, 'User', nil
-
-    assert_not_nil created['uuid'], 'expected uuid for new user'
-    assert_not_nil created['email'], 'expected non-nil email'
-    assert_equal created['email'], 'foo at example.com', 'expected input email'
-
-    # three new links: system_group, arvados#user, and 'All users' group.
-    verify_num_links @all_links_at_start, 3
-
-    verify_link response_items, 'arvados#user', true, 'permission', 'can_login',
-        created['uuid'], created['email'], 'arvados#user', false, 'User'
-
-    verify_link response_items, 'arvados#group', true, 'permission', 'can_read',
-        'All users', created['uuid'], 'arvados#group', true, 'Group'
-
-    verify_link response_items, 'arvados#repository', false, 'permission', 'can_manage',
-        'test_repo', created['uuid'], 'arvados#repository', true, 'Repository'
-
-    verify_link response_items, 'arvados#virtualMachine', false, 'permission', 'can_login',
-        nil, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
-
-   # invoke setup with a repository
-    post :setup, {
-      openid_prefix: 'http://www.example.com/account',
       repo_name: 'new_repo',
-      uuid: created['uuid']
+      uuid: active_user['uuid']
     }
 
     assert_response :success
@@ -545,7 +527,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     response_items = JSON.parse(@response.body)['items']
     created = find_obj_in_resp response_items, 'User', nil
 
-    assert_equal 'foo at example.com', created['email'], 'expected input email'
+    assert_equal active_user[:email], created['email'], 'expected input email'
 
      # verify links
     verify_link response_items, 'arvados#group', true, 'permission', 'can_read',
@@ -556,15 +538,17 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
 
     verify_link response_items, 'arvados#virtualMachine', false, 'permission', 'can_login',
         nil, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
+  end
 
-    # invoke setup with a vm_uuid
+  test "setup active user with vm and no repo" do
+    authorize_with :admin
+    active_user = users(:active)
+
+    # invoke setup with a repository
     post :setup, {
       vm_uuid: @vm_uuid,
-      openid_prefix: 'http://www.example.com/account',
-      user: {
-        email: 'junk_email'
-      },
-      uuid: created['uuid']
+      uuid: active_user['uuid'],
+      email: 'junk_email'
     }
 
     assert_response :success
@@ -572,13 +556,12 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     response_items = JSON.parse(@response.body)['items']
     created = find_obj_in_resp response_items, 'User', nil
 
-    assert_equal created['email'], 'foo at example.com', 'expected original email'
+    assert_equal active_user['email'], created['email'], 'expected original email'
 
     # verify links
     verify_link response_items, 'arvados#group', true, 'permission', 'can_read',
         'All users', created['uuid'], 'arvados#group', true, 'Group'
 
-    # since no repo name in input, we won't get any; even though user has one
     verify_link response_items, 'arvados#repository', false, 'permission', 'can_manage',
         'new_repo', created['uuid'], 'arvados#repository', true, 'Repository'
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list