3153: when new_users_are_active config param is set, even blacklisted users will...
authorradhika <radhika@curoverse.com>
Sat, 23 Aug 2014 17:19:39 +0000 (13:19 -0400)
committerradhika <radhika@curoverse.com>
Sat, 23 Aug 2014 17:19:39 +0000 (13:19 -0400)
services/api/app/mailers/admin_notifier.rb
services/api/test/unit/user_test.rb

index 035072b93423311a895d7dc6e10deb4b131b0010..d86a2814abdeed9007ed7c9d52fbbbba03e9be7b 100644 (file)
@@ -12,11 +12,11 @@ class AdminNotifier < ActionMailer::Base
 
       add_to_subject = ''
       if Rails.configuration.auto_setup_new_users
-        add_to_subject = @user.is_invited ? 'and setup' : ', but not setup'
+        add_to_subject = @user.is_invited ? 'and setup ' : ', but not setup '
       end
 
       mail(to: @recipients,
-           subject: "#{Rails.configuration.email_subject_prefix}New user created #{add_to_subject} notification"
+           subject: "#{Rails.configuration.email_subject_prefix}New user created #{add_to_subject}notification"
           )
     end
   end
index 7de3faec7c6e60aa766ee978d13f2579a08346e3..d93d8ae0c887c05fb19a7f23121dd253aa0492c1 100644 (file)
@@ -145,8 +145,9 @@ class UserTest < ActiveSupport::TestCase
     [false, [], [], 'arvados', false, false, true],   # since we are not creating repo and vm login, this blacklisted name is not a problem
 
     [false, [], [], 'arvados@example.com', false, false, true],   # since we are not creating repo and vm login, this blacklisted name is not a problem
-    [true, 'active-notify@example.com', 'inactive-notify@example.com', 'arvados@ex.com', false, false, true],   # since we are not creating repo and vm login, this blacklisted name is not a problem
-    [true, 'active-notify@example.com', 'inactive-notify@example.com', 'root@example.com', true, false, false], # blacklisted name after removing -._ characters
+    [true, 'active-notify@example.com', 'inactive-notify@example.com', 'arvados@example.com', false, false, true],   # since we are not creating repo and vm login, this blacklisted name is not a problem
+    [true, 'active-notify@example.com', 'inactive-notify@example.com', 'root@example.com', true, false, false], # blacklisted name
+    [false, 'active-notify@example.com', 'inactive-notify@example.com', 'root@example.com', true, false, false], # blacklisted name
     [true, 'active-notify@example.com', 'inactive-notify@example.com', 'roo_t@example.com', false, true, true], # not blacklisted name
 
     [false, [], [], '@example.com', true, false, false],  # incorrect format
@@ -524,8 +525,9 @@ class UserTest < ActiveSupport::TestCase
 
     new_user_email_subject = "#{Rails.configuration.email_subject_prefix}New user created notification"
     if Rails.configuration.auto_setup_new_users
-      new_user_email_subject = ok_to_auto_setup ? "#{Rails.configuration.email_subject_prefix}New user created and setup notification" :
-                                                "#{Rails.configuration.email_subject_prefix}New user created, but not setup notification"
+      new_user_email_subject = (ok_to_auto_setup || active) ?
+                                 "#{Rails.configuration.email_subject_prefix}New user created and setup notification" :
+                                 "#{Rails.configuration.email_subject_prefix}New user created, but not setup notification"
     end
 
     ActionMailer::Base.deliveries.each do |d|
@@ -549,7 +551,7 @@ class UserTest < ActiveSupport::TestCase
 
     if active
       assert_nil new_inactive_user_email, 'Expected no inactive user email after setting up active user'
-      if (not active_recipients.empty?) && ok_to_auto_setup then
+      if not active_recipients.empty? then
         assert_not_nil new_user_email, 'Expected new user email after setup'
         assert_equal Rails.configuration.user_notifier_email_from, new_user_email.from[0]
         assert_equal active_recipients, new_user_email.to[0]