Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e70405f
commit 3b808cc
Showing
6 changed files
with
129 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
defmodule Swoosh.Integration.MailgunAdapterTest do | ||
use ExUnit.Case, async: true | ||
|
||
alias Swoosh.Adapters.Mailgun | ||
import Swoosh.Email | ||
|
||
@moduletag external: true | ||
|
||
test "Mailgun Adapter" do | ||
sandbox_domain = System.get_env("MAILGUN_SANDBOX_DOMAIN") | ||
|
||
config = %{domain: sandbox_domain, api_key: System.get_env("MAILGUN_API_KEY")} | ||
|
||
email = | ||
%Swoosh.Email{} | ||
|> from("Mailgun Test <mailgun@#{sandbox_domain}>") | ||
|> reply_to("mailgun@#{sandbox_domain}") | ||
|> to("leafybasil+swoosh@gmail.com") | ||
|> cc("leafybasil+swooshcc@gmail.com") | ||
|> bcc("leafybasil+swooshbcc@gmail.com") | ||
|> subject("Mailgun integration test") | ||
|> text_body("Hey, just testing!") | ||
|> html_body("<h1>Hey, just <i>testing!</i></h1>") | ||
|
||
assert {:ok, response} = Swoosh.Adapters.Mailgun.deliver(email, config) | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
defmodule Swoosh.Integration.MandrillAdapterTest do | ||
use ExUnit.Case, async: true | ||
|
||
alias Swoosh.Adapters.Mandrill | ||
import Swoosh.Email | ||
|
||
@moduletag external: true | ||
|
||
test "Mandrill Adapter" do | ||
config = %{api_key: System.get_env("MANDRILL_API_KEY")} | ||
|
||
email = | ||
%Swoosh.Email{} | ||
|> from("steve@stevedomin.com") | ||
|> reply_to("mandrill@test.com") | ||
|> to("leafybasil+swoosh@gmail.com") | ||
|> cc("leafybasil+swooshcc@gmail.com") | ||
|> bcc("leafybasil+swooshbcc@gmail.com") | ||
|> subject("Mandrill integration test") | ||
|> text_body("Hey, just testing!") | ||
|> html_body("<h1>Hey, just <i>testing!</i></h1>") | ||
|
||
assert {:ok, response} = Swoosh.Adapters.Mandrill.deliver(email, config) | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
defmodule Swoosh.Integration.PostmarkAdapterTest do | ||
use ExUnit.Case, async: true | ||
|
||
alias Swoosh.Adapters.Postmark | ||
import Swoosh.Email | ||
|
||
@moduletag external: true | ||
|
||
test "Postmark Adapter" do | ||
config = %{api_key: System.get_env("POSTMARK_API_KEY")} | ||
|
||
email = | ||
%Swoosh.Email{} | ||
|> from("Postmark Test <admin@playr.io>") | ||
|> reply_to("leafybasil+swoosh@gmail.com") | ||
|> to("leafybasil+swoosh@gmail.com") | ||
|> cc("leafybasil+swooshcc@gmail.com") | ||
|> bcc("leafybasil+swooshbcc@gmail.com") | ||
|> subject("Postmark integration test") | ||
|> text_body("Hey, just testing!") | ||
|> html_body("<h1>Hey, just <i>testing!</i></h1>") | ||
|
||
assert {:ok, response} = Swoosh.Adapters.Postmark.deliver(email, config) | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
defmodule Swoosh.Integration.SendgridAdapterTest do | ||
use ExUnit.Case, async: true | ||
|
||
alias Swoosh.Adapters.Sendgrid | ||
import Swoosh.Email | ||
|
||
@moduletag external: true | ||
|
||
test "Sendgrid Adapter" do | ||
config = %{api_key: System.get_env("SENDGRID_API_KEY")} | ||
|
||
email = | ||
%Swoosh.Email{} | ||
|> from("Sendgrid Test <test@sendgrid.com>") | ||
|> reply_to("test@#sendgrid.com") | ||
|> to("leafybasil+swoosh@gmail.com") | ||
|> cc("leafybasil+swooshcc@gmail.com") | ||
|> bcc("leafybasil+swooshbcc@gmail.com") | ||
|> subject("Sendgrid integration test") | ||
|> text_body("Hey, just testing!") | ||
|> html_body("<h1>Hey, just <i>testing!</i></h1>") | ||
|
||
assert {:ok, response} = Swoosh.Adapters.Sendgrid.deliver(email, config) | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
defmodule Swoosh.Integration.SMTPTest do | ||
use ExUnit.Case, async: true | ||
|
||
alias Swoosh.Adapters.Sendgrid | ||
import Swoosh.Email | ||
|
||
@moduletag external: true | ||
|
||
test "Sendgrid Adapter" do | ||
config = %{relay: System.get_env("SMTP_RELAY"), username: System.get_env("SMTP_USERNAME"), | ||
password: System.get_env("SMTP_PASSWORD")} | ||
|
||
email = | ||
%Swoosh.Email{} | ||
|> from("SMTP Test <test@smtp.com>") | ||
|> reply_to("test@#sendgrid.com") | ||
|> to("leafybasil+smtp@gmail.com") | ||
|> cc("leafybasil+smtp@gmail.com") | ||
|> bcc("leafybasil+smtp@gmail.com") | ||
|> subject("SMTP integration test") | ||
|> text_body("Hey, just testing!") | ||
|> html_body("<h1>Hey, just <i>testing!</i></h1>") | ||
|
||
assert {:ok, response} = Swoosh.Adapters.SMTP.deliver(email, config) | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
ExUnit.start() | ||
ExUnit.configure(exclude: :external) | ||
|
||
Application.ensure_all_started(:bypass) |