Skip to content

Commit

Permalink
Fix: login auth type mail options (#113)
Browse files Browse the repository at this point in the history
* added mail options test to catch auth type case

* fixed auth type mail options not being saved
  • Loading branch information
galviset authored and syphax-bouazzouni committed Nov 22, 2023
1 parent f44f7ba commit 7d3359b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ontologies_linked_data/utils/notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,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 @@ -148,4 +148,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

0 comments on commit 7d3359b

Please sign in to comment.