Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: login auth type mail options #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ontologies_linked_data/utils/notifications.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def self.mail_options
}

if LinkedData.settings.smtp_auth_type && LinkedData.settings.smtp_auth_type != :none
options.merge({
options.merge!({
user_name: LinkedData.settings.smtp_user,
password: LinkedData.settings.smtp_password,
authentication: LinkedData.settings.smtp_auth_type
Expand Down
26 changes: 26 additions & 0 deletions test/util/test_notifications.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,30 @@ def test_remote_ontology_pull_notification
end
end
end

def test_mail_options
options = LinkedData::Utils::Notifier.mail_options
expected_options = {
address: LinkedData.settings.smtp_host,
port: LinkedData.settings.smtp_port,
domain: LinkedData.settings.smtp_domain
}
assert_equal options, expected_options

# testing SMTP authentification-based login
current_auth_type = LinkedData.settings.smtp_auth_type
LinkedData.settings.smtp_auth_type = :plain
options = LinkedData::Utils::Notifier.mail_options
expected_options = {
address: LinkedData.settings.smtp_host,
port: LinkedData.settings.smtp_port,
domain: LinkedData.settings.smtp_domain,
user_name: LinkedData.settings.smtp_user,
password: LinkedData.settings.smtp_password,
authentication: LinkedData.settings.smtp_auth_type
}
assert_equal options, expected_options

LinkedData.settings.smtp_auth_type = current_auth_type
end
end