Include autenticazione, progetti isolati, mail marketing HTML con SMTP, test A/B e editor WYSIWYG. Co-authored-by: Cursor <cursoragent@cursor.com>
38 lines
1.1 KiB
Ruby
38 lines
1.1 KiB
Ruby
require "test_helper"
|
|
|
|
class MailIdentitiesControllerTest < ActionDispatch::IntegrationTest
|
|
test "non admin cannot manage smtp accounts" do
|
|
login_as users(:marco)
|
|
follow_redirect! if response.redirect?
|
|
|
|
get mail_identities_path
|
|
assert_redirected_to root_path
|
|
end
|
|
|
|
test "admin can create an smtp account" do
|
|
login_as users(:admin)
|
|
follow_redirect! if response.redirect?
|
|
|
|
assert_difference "MailIdentity.count", 1 do
|
|
post mail_identities_path, params: {
|
|
mail_identity: {
|
|
name: "MatchLiveTV",
|
|
from_name: "MatchLiveTV",
|
|
from_email: "hello@matchlivetv.test",
|
|
smtp_host: "smtp.test",
|
|
smtp_port: 587,
|
|
smtp_username: "hello@matchlivetv.test",
|
|
smtp_password: "super-secret",
|
|
smtp_authentication: "plain",
|
|
encryption: "starttls",
|
|
verify_ssl: "1",
|
|
active: "1"
|
|
}
|
|
}
|
|
end
|
|
assert_redirected_to mail_identities_path
|
|
identity = MailIdentity.find_by!(from_email: "hello@matchlivetv.test")
|
|
assert_equal "super-secret", identity.smtp_password
|
|
end
|
|
end
|