1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
7 class UserNotifierTest < ActionMailer::TestCase
9 # Send the email, then test that it got queued
10 test "account is setup" do
13 Rails.configuration.Users.UserSetupMailText = %{
14 <% if not @user.full_name.empty? -%>
15 <%= @user.full_name %>,
20 Your Arvados shell account has been set up. Please visit the virtual machines page <% if Rails.configuration.Services.Workbench1.ExternalURL %>at
22 <%= Rails.configuration.Services.Workbench1.ExternalURL %><%= "/" if !Rails.configuration.Services.Workbench1.ExternalURL.to_s.end_with?("/") %>users/<%= @user.uuid%>/virtual_machines <% else %><% end %>
24 for connection instructions.
30 email = UserNotifier.account_is_setup user
34 # Test the body of the sent email contains what we expect it to
35 assert_equal Rails.configuration.Users.UserNotifierEmailFrom, email.from.first
36 assert_equal user.email, email.to.first
37 assert_equal 'Welcome to Arvados - account enabled', email.subject
38 assert (email.body.to_s.include? 'Your Arvados shell account has been set up'),
39 'Expected Your Arvados shell account has been set up in email body'
40 assert (email.body.to_s.include? Rails.configuration.Services.Workbench1.ExternalURL.to_s),
41 'Expected workbench url in email body'