X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f9ae5b90a5e04477133ca7a7d34bd3eebf862474..db166b9539a0f18621e2c980137d082357b1a680:/services/api/test/unit/user_notifier_test.rb diff --git a/services/api/test/unit/user_notifier_test.rb b/services/api/test/unit/user_notifier_test.rb index 79d3e15ef6..e58c273a6d 100644 --- a/services/api/test/unit/user_notifier_test.rb +++ b/services/api/test/unit/user_notifier_test.rb @@ -9,17 +9,37 @@ class UserNotifierTest < ActionMailer::TestCase # Send the email, then test that it got queued test "account is setup" do user = users :active + + Rails.configuration.Users.UserNotifierEmailBcc = ConfigLoader.to_OrderedOptions({"bcc-notify@example.com"=>{},"bcc-notify2@example.com"=>{}}) + Rails.configuration.Users.UserSetupMailText = %{ +<% if not @user.full_name.empty? -%> +<%= @user.full_name %>, +<% else -%> +Hi there, +<% end -%> + +Your Arvados shell account has been set up. Please visit the virtual machines page <% if Rails.configuration.Services.Workbench1.ExternalURL %>at + +<%= Rails.configuration.Services.Workbench1.ExternalURL %><%= "/" if !Rails.configuration.Services.Workbench1.ExternalURL.to_s.end_with?("/") %>users/<%= @user.uuid%>/virtual_machines <% else %><% end %> + +for connection instructions. + +Thanks, +The Arvados team. +} + email = UserNotifier.account_is_setup user assert_not_nil email # Test the body of the sent email contains what we expect it to - assert_equal Rails.configuration.Users["UserNotifierEmailFrom"], email.from.first + assert_equal Rails.configuration.Users.UserNotifierEmailFrom, email.from.first + assert_equal Rails.configuration.Users.UserNotifierEmailBcc.stringify_keys.keys, email.bcc assert_equal user.email, email.to.first - assert_equal 'Welcome to Arvados - shell account enabled', email.subject + assert_equal 'Welcome to Arvados - account enabled', email.subject assert (email.body.to_s.include? 'Your Arvados shell account has been set up'), 'Expected Your Arvados shell account has been set up in email body' - assert (email.body.to_s.include? Rails.configuration.Services["Workbench1"]["ExternalURL"].to_s), + assert (email.body.to_s.include? Rails.configuration.Services.Workbench1.ExternalURL.to_s), 'Expected workbench url in email body' end