[ARVADOS] updated: 30a74a09202eedbea5e5c7bd59768e616cd38c79

git at public.curoverse.com git at public.curoverse.com
Tue Aug 12 09:17:47 EDT 2014


Summary of changes:
 apps/workbench/config/application.default.yml      |  2 +-
 .../test/integration/application_layout_test.rb    |  5 +-
 doc/api/methods/collections.html.textile.liquid    |  3 +
 .../tutorial-trait-search.html.textile.liquid      | 44 +++++------
 .../tutorials/tutorial-keep.html.textile.liquid    |  4 +-
 sdk/cli/bin/crunch-job                             | 24 +++---
 .../api/app/controllers/application_controller.rb  | 12 ++-
 .../arvados/v1/collections_controller.rb           | 85 ++++++++++++++--------
 services/api/app/models/arvados_model.rb           | 22 ++++++
 services/api/app/models/collection.rb              |  7 +-
 services/api/app/models/user.rb                    |  2 +-
 services/api/script/crunch-dispatch.rb             | 15 +++-
 .../test/fixtures/api_client_authorizations.yml    |  6 ++
 services/api/test/fixtures/users.yml               | 30 +++++---
 .../arvados/v1/collections_controller_test.rb      | 47 +++++++++++-
 .../functional/arvados/v1/users_controller_test.rb | 32 ++++++--
 16 files changed, 250 insertions(+), 90 deletions(-)

       via  30a74a09202eedbea5e5c7bd59768e616cd38c79 (commit)
       via  ed1580a38c1aae0910cef83605622a41d927fba3 (commit)
       via  0ce64862c39e93591635f31a47c5b7d4aa0b9a19 (commit)
       via  268e630e92fe5088d7bfb9baf15a86b099e7faa0 (commit)
       via  bb3c3a0792e1f6be7fcb5e663ac82d5a9c9c0c13 (commit)
       via  6ba24a89c7b2fa6f600910dc28af218500a463dd (commit)
       via  ddb56f97e792fb7bc6471a75b900ba096164d424 (commit)
       via  a4993e59eaefab303fb9d3b4a2cdc07d166046a4 (commit)
       via  a2f138c3ea2a6245cd5ea8008b709ed16720392d (commit)
       via  d7581fb19947ff1efa3b5dcc045b24377e1fe3d6 (commit)
       via  b349b49b54f5bebc624f4afb981dddea1bfc0d61 (commit)
       via  55db20860c90c60dd231083c1cc81001c3fbe971 (commit)
      from  7b9529d616cdf9022392321dc055f668a1a1ba62 (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 30a74a09202eedbea5e5c7bd59768e616cd38c79
Merge: 268e630 ed1580a
Author: radhika <radhika at curoverse.com>
Date:   Tue Aug 12 08:59:05 2014 -0400

    Merge branch 'master' into 3296-user-profile


commit 268e630e92fe5088d7bfb9baf15a86b099e7faa0
Author: radhika <radhika at curoverse.com>
Date:   Tue Aug 12 08:52:38 2014 -0400

    3296: add span tag to profile message in config to serve as an example for admins.

diff --git a/apps/workbench/config/application.default.yml b/apps/workbench/config/application.default.yml
index 32e1495..3b4c2c0 100644
--- a/apps/workbench/config/application.default.yml
+++ b/apps/workbench/config/application.default.yml
@@ -130,4 +130,4 @@ common:
 
   # Use "user_profile_form_message" to configure the message you want to display in
   # the profile page. If this is not provided, a default message will be displayed.
-  user_profile_form_message: Welcome to Arvados. Please fill in all required fields before you can access Arvados Workbench.
+  user_profile_form_message: Welcome to Arvados. Please fill in all required fields before you can access Arvados Workbench. Missing required fields are in <span style="color:red">red</span>.
diff --git a/apps/workbench/test/integration/application_layout_test.rb b/apps/workbench/test/integration/application_layout_test.rb
index 880cd8a..f231e4d 100644
--- a/apps/workbench/test/integration/application_layout_test.rb
+++ b/apps/workbench/test/integration/application_layout_test.rb
@@ -190,7 +190,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
       end
     end
 
-    assert page.has_text? profile_message
+    assert page.has_text? profile_message[0,25]
     assert page.has_text? required_field_title
     page.find_field('user[prefs][:profile][:'+required_field_key+']').set 'value to fill required field'
 

commit a2f138c3ea2a6245cd5ea8008b709ed16720392d
Author: radhika <radhika at curoverse.com>
Date:   Tue Aug 12 08:41:03 2014 -0400

    3296: cover the case where prefs was there but no profile in profile check.

diff --git a/apps/workbench/test/integration/application_layout_test.rb b/apps/workbench/test/integration/application_layout_test.rb
index aae6dc2..880cd8a 100644
--- a/apps/workbench/test/integration/application_layout_test.rb
+++ b/apps/workbench/test/integration/application_layout_test.rb
@@ -259,6 +259,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
     ['active', api_fixture('users')['active'], true, true],
     ['admin', api_fixture('users')['admin'], true, true],
     ['active_no_prefs', api_fixture('users')['active_no_prefs'], true, false],
+    ['active_no_prefs_profile', api_fixture('users')['active_no_prefs_profile'], true, false],
   ].each do |token, user, invited, has_profile|
       test "visit home page when profile is configured for user #{token}" do
       # Our test config enabled profile by default. So, no need to update config
@@ -279,6 +280,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
     ['active', api_fixture('users')['active'], true, true],
     ['admin', api_fixture('users')['admin'], true, true],
     ['active_no_prefs', api_fixture('users')['active_no_prefs'], true, false],
+    ['active_no_prefs_profile', api_fixture('users')['active_no_prefs_profile'], true, false],
   ].each do |token, user, invited, has_profile|
     test "visit home page when profile not configured for user #{token}" do
       Rails.configuration.user_profile_form_fields = false
@@ -300,6 +302,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
     ['active', api_fixture('users')['active'], true, true],
     ['admin', api_fixture('users')['admin'], true, true],
     ['active_no_prefs', api_fixture('users')['active_no_prefs'], true, false],
+    ['active_no_prefs_profile', api_fixture('users')['active_no_prefs_profile'], true, false],
   ].each do |token, user, invited, has_profile|
     test "check help for user #{token}" do
       Rails.configuration.user_profile_form_fields = false
diff --git a/services/api/app/models/user.rb b/services/api/app/models/user.rb
index 072ad49..64e0d09 100644
--- a/services/api/app/models/user.rb
+++ b/services/api/app/models/user.rb
@@ -435,7 +435,7 @@ class User < ArvadosModel
   # Send notification if the user saved profile for the first time
   def send_profile_created_notification
     if self.prefs_changed?
-      if self.prefs_was.andand.empty?
+      if self.prefs_was.andand.empty? || !self.prefs_was.andand['profile']
         profile_notification_address = Rails.configuration.user_profile_notification_address
         ProfileNotifier.profile_created(self, profile_notification_address).deliver if profile_notification_address
       end
diff --git a/services/api/test/fixtures/api_client_authorizations.yml b/services/api/test/fixtures/api_client_authorizations.yml
index 01667f7..c0bce93 100644
--- a/services/api/test/fixtures/api_client_authorizations.yml
+++ b/services/api/test/fixtures/api_client_authorizations.yml
@@ -168,3 +168,9 @@ active_no_prefs:
   user: active_no_prefs
   api_token: 3kg612cdc0f3415c2428b9758f33bdfb07bc3561b00e86qdmi
   expires_at: 2038-01-01 00:00:00
+
+active_no_prefs_profile:
+  api_client: untrusted
+  user: active_no_prefs_profile
+  api_token: 3kg612cdc0f3415c242856758f33bdfb07bc3561b00e86qdmi
+  expires_at: 2038-01-01 00:00:00
diff --git a/services/api/test/fixtures/users.yml b/services/api/test/fixtures/users.yml
index 5ead254..5c68836 100644
--- a/services/api/test/fixtures/users.yml
+++ b/services/api/test/fixtures/users.yml
@@ -11,7 +11,7 @@ admin:
   is_admin: true
   prefs:
     profile:
-      organization: Curoverse
+      organization: example.com
       role: IT
 
 miniadmin:
@@ -25,7 +25,7 @@ miniadmin:
   is_admin: false
   prefs:
     profile:
-      organization: Curoverse
+      organization: example.com
       role: IT
 
 rominiadmin:
@@ -39,7 +39,7 @@ rominiadmin:
   is_admin: false
   prefs:
     profile:
-      organization: Curoverse
+      organization: example.com
       role: IT
 
 active:
@@ -53,7 +53,7 @@ active:
   is_admin: false
   prefs:
     profile:
-      organization: Curoverse
+      organization: example.com
       role: Computational biologist
 
 project_viewer:
@@ -67,7 +67,7 @@ project_viewer:
   is_admin: false
   prefs:
     profile:
-      organization: Curoverse
+      organization: example.com
       role: Computational biologist
 
 future_project_user:
@@ -81,7 +81,7 @@ future_project_user:
   is_admin: false
   prefs:
     profile:
-      organization: Curoverse
+      organization: example.com
       role: Computational biologist
 
 spectator:
@@ -95,7 +95,7 @@ spectator:
   is_admin: false
   prefs:
     profile:
-      organization: Curoverse
+      organization: example.com
       role: Computational biologist
 
 inactive_uninvited:
@@ -152,16 +152,28 @@ job_reader:
   is_admin: false
   prefs:
     profile:
-      organization: Curoverse
+      organization: example.com
       role: Computational biologist
 
 active_no_prefs:
   owner_uuid: zzzzz-tpzed-000000000000000
   uuid: zzzzz-tpzed-a46c42d1td4aoj4
-  email: active_no_profile at arvados.local
+  email: active_no_prefs at arvados.local
   first_name: NoPrefs
   last_name: NoProfile
   identity_url: https://active_no_prefs.openid.local
   is_active: true
   is_admin: false
   prefs: {}
+
+active_no_prefs_profile:
+  owner_uuid: zzzzz-tpzed-000000000000000
+  uuid: zzzzz-tpzed-a46c98d1td4aoj4
+  email: active_no_prefs_profile at arvados.local
+  first_name: HasPrefs
+  last_name: NoProfile
+  identity_url: https://active_no_prefs_profile.openid.local
+  is_active: true
+  is_admin: false
+  prefs:
+    test: abc
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 299ae9e..a448d1a 100644
--- a/services/api/test/functional/arvados/v1/users_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/users_controller_test.rb
@@ -842,20 +842,42 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     check_active_users_index
   end
 
-  test "update inactive user profile and expect notification email" do
+  test "update active_no_prefs user profile and expect notification email" do
     authorize_with :admin
 
     put :update, {
-      id: users(:inactive).uuid,
+      id: users(:active_no_prefs).uuid,
       user: {
-        prefs: {:profile => {'organization' => 'Curoverse'}}
+        prefs: {:profile => {'organization' => 'example.com'}}
       }
     }
     assert_response :success
 
     found_email = false
     ActionMailer::Base.deliveries.andand.each do |email|
-      if email.subject == "Profile created by #{users(:inactive).email}"
+      if email.subject == "Profile created by #{users(:active_no_prefs).email}"
+        found_email = true
+        break
+      end
+    end
+    assert_equal true, found_email, 'Expected email after creating profile'
+  end
+
+  test "update active_no_prefs_profile user profile and expect notification email" do
+    authorize_with :admin
+
+    user = {}
+    user[:prefs] = users(:active_no_prefs_profile).prefs
+    user[:prefs][:profile] = {:profile => {'organization' => 'example.com'}}
+    put :update, {
+      id: users(:active_no_prefs_profile).uuid,
+      user: user
+    }
+    assert_response :success
+
+    found_email = false
+    ActionMailer::Base.deliveries.andand.each do |email|
+      if email.subject == "Profile created by #{users(:active_no_prefs_profile).email}"
         found_email = true
         break
       end
@@ -869,7 +891,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     put :update, {
       id: users(:active).uuid,
       user: {
-        prefs: {:profile => {'organization' => 'Curoverse'}}
+        prefs: {:profile => {'organization' => 'anotherexample.com'}}
       }
     }
     assert_response :success

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list