-
-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch from Bamboo to Swoosh for email delivery
- Loading branch information
Showing
20 changed files
with
125 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,6 +72,8 @@ config :mime, :types, %{ | |
"application/x-asciicast" => ["cast"] | ||
} | ||
|
||
config :asciinema, Asciinema.Emails.Mailer, adapter: Swoosh.Adapters.Local | ||
|
||
config :sentry, | ||
dsn: "https://public:[email protected]/1", | ||
environment_name: config_env(), | ||
|
@@ -85,8 +87,6 @@ config :asciinema, Asciinema.FileStore.Local, path: "uploads/" | |
|
||
config :asciinema, Asciinema.FileCache, path: "cache/" | ||
|
||
config :asciinema, Asciinema.Emails.Mailer, adapter: Bamboo.LocalAdapter | ||
|
||
config :asciinema, :png_generator, Asciinema.PngGenerator.Rsvg | ||
|
||
config :asciinema, Asciinema.PngGenerator.Rsvg, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
defmodule Asciinema.Emails.Mailer do | ||
use Bamboo.Mailer, otp_app: :asciinema | ||
use Swoosh.Mailer, otp_app: :asciinema | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
lib/asciinema_web/templates/email/account_deletion.html.eex
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,8 @@ import Config | |
## Use Mailgun for mail delivery: | ||
|
||
# config :asciinema, Asciinema.Mailer, | ||
# adapter: Bamboo.SMTPAdapter, | ||
# server: "smtp.mailgun.org", | ||
# adapter: Swoosh.Adapters.SMTP, | ||
# relay: "smtp.mailgun.org", | ||
# port: 587, | ||
# username: "[email protected]", | ||
# password: "mailgun-password", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
defmodule AsciinemaTest do | ||
import Asciinema.Factory | ||
import Bamboo.Test | ||
import Swoosh.TestAssertions | ||
use Asciinema.DataCase | ||
use Oban.Testing, repo: Asciinema.Repo | ||
alias Asciinema.Recordings | ||
|
@@ -29,15 +29,15 @@ defmodule AsciinemaTest do | |
|
||
assert Asciinema.send_login_email("[email protected]") == :ok | ||
|
||
assert_email_delivered_with(to: [{nil, "[email protected]"}], subject: "Login to localhost") | ||
assert_email_sent(to: [{nil, "[email protected]"}], subject: "Login to localhost") | ||
end | ||
|
||
test "existing user, by username" do | ||
insert(:user, username: "foobar", email: "[email protected]") | ||
|
||
assert Asciinema.send_login_email("foobar") == :ok | ||
|
||
assert_email_delivered_with( | ||
assert_email_sent( | ||
to: [{nil, "[email protected]"}], | ||
subject: "Login to localhost" | ||
) | ||
|
@@ -46,25 +46,25 @@ defmodule AsciinemaTest do | |
test "non-existing user, by email" do | ||
assert Asciinema.send_login_email("[email protected]") == :ok | ||
|
||
assert_email_delivered_with(to: [{nil, "[email protected]"}], subject: "Welcome to localhost") | ||
assert_email_sent(to: [{nil, "[email protected]"}], subject: "Welcome to localhost") | ||
end | ||
|
||
test "non-existing user, by email, when sign up is disabled" do | ||
assert Asciinema.send_login_email("[email protected]", false) == {:error, :user_not_found} | ||
|
||
assert_no_emails_delivered() | ||
assert_no_email_sent() | ||
end | ||
|
||
test "non-existing user, by email, when email is invalid" do | ||
assert Asciinema.send_login_email("new@") == {:error, :email_invalid} | ||
|
||
assert_no_emails_delivered() | ||
assert_no_email_sent() | ||
end | ||
|
||
test "non-existing user, by username" do | ||
assert Asciinema.send_login_email("idontexist") == {:error, :user_not_found} | ||
|
||
assert_no_emails_delivered() | ||
assert_no_email_sent() | ||
end | ||
end | ||
|
||
|
Oops, something went wrong.