[ARVADOS] updated: dff5bfa5afbdd49bf0003b75583b7120f21b7df7

git at public.curoverse.com git at public.curoverse.com
Sun Mar 23 21:17:53 EDT 2014


Summary of changes:
 .../app/controllers/arvados/v1/users_controller.rb |    4 ++
 .../functional/arvados/v1/users_controller_test.rb |   45 ++++++++++++++++---
 2 files changed, 42 insertions(+), 7 deletions(-)

       via  dff5bfa5afbdd49bf0003b75583b7120f21b7df7 (commit)
      from  83fa2045a190732f8dd9bed3e5c6071ce66da07f (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 dff5bfa5afbdd49bf0003b75583b7120f21b7df7
Author: radhika chippada <radhika at radhika.curoverse>
Date:   Sun Mar 23 21:17:26 2014 -0400

    Raise ArgumentError when required openid_prefix is not passed.

diff --git a/services/api/app/controllers/arvados/v1/users_controller.rb b/services/api/app/controllers/arvados/v1/users_controller.rb
index 3d4a397..8d722ba 100644
--- a/services/api/app/controllers/arvados/v1/users_controller.rb
+++ b/services/api/app/controllers/arvados/v1/users_controller.rb
@@ -99,6 +99,10 @@ class Arvados::V1::UsersController < ApplicationController
       @object = model_class.new resource_attrs
     end
 
+    if !params[:openid_prefix]
+      raise ArgumentError.new "Required openid_prefix parameter is missing."
+    end
+
     @response = User.setup @object, params[:openid_prefix],
                 params[:repo_name], params[:vm_uuid]
     render json: { kind: "arvados#HashList", items: @response }
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 474c1da..f1ba909 100644
--- a/services/api/test/functional/arvados/v1/users_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/users_controller_test.rb
@@ -64,6 +64,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
 
     post :setup, {
       repo_name: repo_name,
+      openid_prefix: 'https://www.google.com/accounts/o8/id',
       user: {
         uuid: "this_is_agreeable",        
         first_name: "in_create_test_first_name",
@@ -106,6 +107,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
       uuid: 'not_an_existing_uuid_and_not_email_format',
       repo_name: 'test_repo',
       vm_uuid: @vm_uuid,
+      openid_prefix: 'https://www.google.com/accounts/o8/id'
     }
     response_body = JSON.parse(@response.body)
     response_errors = response_body['errors']
@@ -124,7 +126,8 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     post :setup, {
       user: {uuid: inactive_user['uuid']},
       repo_name: 'test_repo',
-      vm_uuid: @vm_uuid
+      vm_uuid: @vm_uuid,
+      openid_prefix: 'https://www.google.com/accounts/o8/id'
     }
 
     assert_response :success
@@ -150,7 +153,8 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
 
     post :setup, {
       repo_name: 'test_repo',
-      user: {email: 'abc at xyz.com'}
+      user: {email: 'abc at xyz.com'},
+      openid_prefix: 'https://www.google.com/accounts/o8/id'
     }
 
     assert_response :success
@@ -168,7 +172,8 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     post :setup, {
       repo_name: 'test_repo',
       vm_uuid: 'no_such_vm',
-      user: {email: 'abc at xyz.com'}
+      user: {email: 'abc at xyz.com'},
+      openid_prefix: 'https://www.google.com/accounts/o8/id'
     }
 
     response_body = JSON.parse(@response.body)
@@ -183,6 +188,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
 
     post :setup, {
       repo_name: 'test_repo',
+      openid_prefix: 'https://www.google.com/accounts/o8/id',
       vm_uuid: @vm_uuid,
       user: {email: 'abc at xyz.com'}
     }
@@ -200,7 +206,8 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     authorize_with :admin
 
     post :setup, {
-      user: {email: 'abc at xyz.com'}
+      user: {email: 'abc at xyz.com'},
+      openid_prefix: 'https://www.google.com/accounts/o8/id'
     }
 
     assert_response :success    
@@ -216,6 +223,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     authorize_with :admin
 
     post :setup, {
+      openid_prefix: 'https://www.google.com/accounts/o8/id',
       repo_name: 'test_repo',
       vm_uuid: @vm_uuid,
       user: {
@@ -239,6 +247,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     authorize_with :admin
 
     post :setup, {
+      openid_prefix: 'https://www.google.com/accounts/o8/id',
       repo_name: 'test_repo',
       user: {
         email: 'abc at xyz.com'
@@ -252,8 +261,9 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     verify_num_links @all_links_at_start, 3   # openid, group, and repo. no vm
 
     # create again
-    post :setup, user: {
-      email: 'abc at xyz.com'
+    post :setup, {
+      user: {email: 'abc at xyz.com'},
+      openid_prefix: 'https://www.google.com/accounts/o8/id'
     }
 
     assert_response :success
@@ -306,6 +316,25 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
         nil, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
   end
 
+  test "invoke setup with no openid prefix, expect error" do
+    authorize_with :admin
+
+    post :setup, {
+      repo_name: 'test_repo',
+      user: {
+        first_name: "in_create_test_first_name",
+        last_name: "test_last_name",
+        email: "test at abc.com"
+      }
+    }
+
+    response_body = JSON.parse(@response.body)
+    response_errors = response_body['errors']
+    assert_not_nil response_errors, 'Expected error in response'
+    assert (response_errors.first.include? 'openid_prefix parameter is missing'),
+        'Expected ArgumentError'
+  end
+
   test "create user with user, vm and repo and verify links" do
     authorize_with :admin
 
@@ -315,8 +344,9 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
         last_name: "test_last_name",
         email: "test at abc.com"
       },
+      vm_uuid: @vm_uuid,
       repo_name: 'test_repo',
-      vm_uuid: @vm_uuid
+      openid_prefix: 'https://www.google.com/accounts/o8/id'
     }
 
     assert_response :success
@@ -363,6 +393,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     authorize_with :active
 
     post :setup, {
+      openid_prefix: 'https://www.google.com/accounts/o8/id',
       user: {email: 'abc at xyz.com'}
     }
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list