[ARVADOS] updated: 375c23fa047e5fcd09e71f5c473dbd05cbe14891

git at public.curoverse.com git at public.curoverse.com
Wed Mar 19 16:46:01 EDT 2014


Summary of changes:
 .../app/controllers/arvados/v1/users_controller.rb |   21 +++++-------------
 services/api/script/setup-new-user.rb              |    3 +-
 .../functional/arvados/v1/users_controller_test.rb |   22 +++----------------
 3 files changed, 11 insertions(+), 35 deletions(-)

       via  375c23fa047e5fcd09e71f5c473dbd05cbe14891 (commit)
       via  e5804f99569634967d4affe322a382034d81cfa8 (commit)
      from  23a7957589e03db8576c6547d3204477c2b0e7f3 (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 375c23fa047e5fcd09e71f5c473dbd05cbe14891
Author: radhika chippada <radhika at radhika.curoverse>
Date:   Wed Mar 19 16:32:58 2014 -0400

    Remove -n aka just probe option from the setup-new-user script as per Ward's core review recommendation.

diff --git a/services/api/app/controllers/arvados/v1/users_controller.rb b/services/api/app/controllers/arvados/v1/users_controller.rb
index e07d503..303e6d7 100644
--- a/services/api/app/controllers/arvados/v1/users_controller.rb
+++ b/services/api/app/controllers/arvados/v1/users_controller.rb
@@ -97,9 +97,6 @@ class Arvados::V1::UsersController < ApplicationController
 		end
 		login_perm_props = {identity_url_prefix: openid_prefix}
 
-		# check if only to probe the given user parameter
-		just_probe = (params[:just_probe] == 'true') ? true : false;
-
  		@object = model_class.new resource_attrs
 
 		# If user_param is passed, lookup for user. If exists, skip create and only create any missing links. 
@@ -123,12 +120,6 @@ class Arvados::V1::UsersController < ApplicationController
 			end
 		end
 
-		# if just probing, return any object found	
-		if just_probe 
-			show
-		  return
-		end
-
 		# create if need be, and then create or update the links as needed 
 		if need_to_create
 			if @object.save
diff --git a/services/api/script/setup-new-user.rb b/services/api/script/setup-new-user.rb
index 8462a50..72e1804 100755
--- a/services/api/script/setup-new-user.rb
+++ b/services/api/script/setup-new-user.rb
@@ -24,7 +24,6 @@ If creating a new user record, require authentication from an OpenID \
 with this OpenID prefix *and* a matching email address in order to \
 claim the account.
   eos
-  opt :n, 'Do not change anything, just probe'
 end
 
 log.level = (ENV['DEBUG'] || opts.debug) ? Logger::DEBUG : Logger::WARN
@@ -38,7 +37,7 @@ require 'arvados'
 arv = Arvados.new(api_version: 'v1')
 
 begin
-	new_user = arv.user.create(user_param: user_arg, repo_name: user_repo_name, vm_uuid: vm_uuid, openid_prefix: opts.openid_prefix, just_probe: opts.n, user: {})
+	new_user = arv.user.create(user_param: user_arg, repo_name: user_repo_name, vm_uuid: vm_uuid, openid_prefix: opts.openid_prefix, user: {})
 	log.warn new_user
 rescue Exception => e #Arvados::TransactionFailedError
 	log.warn e.message
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 1ea5494..a7bdb7c 100644
--- a/services/api/test/functional/arvados/v1/users_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/users_controller_test.rb
@@ -182,22 +182,6 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     assert_nil response_object['first_name'], 'expecting no first name since it will be reset when user_param is used'
 	end
 
-	test "create user with valid email user_param, vm and repo as input with opt.n" do
-    authorize_with :admin
-
-    post :create, {
-      user_param: 'abc at xyz.com',
-      repo_name: 'test_repo',
-			vm_uuid: 'no_such_vm',
-			just_probe: 'true',
-      user: {}
-    }
-
-    assert_response :success
-    response_object = JSON.parse(@response.body)
-    assert_nil response_object['uuid'], 'expected null uuid since no object created due to just probe'
-	end
-
 	test "create user twice with user param and check links are not recreated" do
     authorize_with :admin
 

commit e5804f99569634967d4affe322a382034d81cfa8
Author: radhika chippada <radhika at radhika.curoverse>
Date:   Wed Mar 19 16:18:54 2014 -0400

    Update comments in the tests

diff --git a/services/api/app/controllers/arvados/v1/users_controller.rb b/services/api/app/controllers/arvados/v1/users_controller.rb
index 6558655..e07d503 100644
--- a/services/api/app/controllers/arvados/v1/users_controller.rb
+++ b/services/api/app/controllers/arvados/v1/users_controller.rb
@@ -102,9 +102,9 @@ class Arvados::V1::UsersController < ApplicationController
 
  		@object = model_class.new resource_attrs
 
-		# If user_param is passed, lookup for user. If exists, skip create and create any missing links. 
+		# If user_param is passed, lookup for user. If exists, skip create and only create any missing links. 
 		if params[:user_param]
-			begin 
+			begin
 	 			@object_found = find_user_from_input params[:user_param], params[:user_param]
 		  end
 			if !@object_found
@@ -117,7 +117,7 @@ class Arvados::V1::UsersController < ApplicationController
 		else		# need to create user for the given user data
 	 		@object_found = find_user_from_input @object[:uuid], @object[:email]
 			if !@object_found
-  	 		need_to_create = true
+  	 		need_to_create = true		# use the user object sent in to create with the user
 			else
 				@object = @object_found
 			end
@@ -131,7 +131,7 @@ class Arvados::V1::UsersController < ApplicationController
 
 		# create if need be, and then create or update the links as needed 
 		if need_to_create
-			if @object.save		# save succeeded
+			if @object.save
 				oid_login_perm = Link.where(tail_uuid: @object[:email],
                             				head_kind: 'arvados#user',
                             				link_class: 'permission',
@@ -164,7 +164,7 @@ class Arvados::V1::UsersController < ApplicationController
 
 	protected 
 
-	# find the user from the given user parameter
+	# find the user from the given user parameters
 	def find_user_from_input(user_uuid, user_email)
 		if user_uuid
 			found_object = User.find_by_uuid user_uuid
@@ -290,5 +290,5 @@ class Arvados::V1::UsersController < ApplicationController
 			end
 		end
 	end
- 
+
 end
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 fe0c22a..1ea5494 100644
--- a/services/api/test/functional/arvados/v1/users_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/users_controller_test.rb
@@ -162,7 +162,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     assert_equal response_object['email'], 'abc at xyz.com', 'expecting given email'
 	end
 
-	test "create user with user_param and user which will be ignored" do
+	test "create user with user_param and non-empty user which will be ignored" do
     authorize_with :admin
 
     post :create, {
@@ -170,7 +170,8 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
       repo_name: 'test_repo',
 			vm_uuid: 'no_such_vm',
       user: {
-				email: 'will_be_ignored at xyz.om'
+        first_name: 'test_first_name',
+				email: 'will_be_ignored at xyz.com'
 			}
     }
 
@@ -178,6 +179,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     response_object = JSON.parse(@response.body)
     assert_not_nil response_object['uuid'], 'expected non-null uuid for the newly created user'
     assert_equal response_object['email'], 'abc at xyz.com', 'expecting user_param as email'
+    assert_nil response_object['first_name'], 'expecting no first name since it will be reset when user_param is used'
 	end
 
 	test "create user with valid email user_param, vm and repo as input with opt.n" do

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list