-
-
Notifications
You must be signed in to change notification settings - Fork 130
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
Showing
15 changed files
with
294 additions
and
50 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
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
defmodule Pigeon.ConfigError do | ||
defexception reason: nil, config: nil | ||
|
||
@impl true | ||
def message(%{config: config, reason: reason}) do | ||
""" | ||
#{reason} | ||
The following configuration was given: | ||
#{inspect(config, pretty: true)} | ||
""" | ||
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
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
Binary file not shown.
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,4 +1,25 @@ | ||
defmodule Pigeon.ADM.ConfigTest do | ||
use ExUnit.Case | ||
doctest Pigeon.ADM.Config, import: true | ||
|
||
@invalid_key_msg ~r/^attempted to start without valid client id and secret/ | ||
|
||
test "success if configured with client id and secret" do | ||
config = Pigeon.ADM.Config.new(name: :test, client_id: "amzn1.iba-client.abc123", client_secret: "abc123") | ||
{:ok, _} = Pigeon.ADM.Worker.init({:ok, config}) | ||
end | ||
|
||
test "raises if configured with invalid client id" do | ||
assert_raise(Pigeon.ConfigError, @invalid_key_msg, fn -> | ||
config = Pigeon.ADM.Config.new(name: :test, client_id: nil, client_secret: "abc123") | ||
Pigeon.ADM.Worker.init({:ok, config}) | ||
end) | ||
end | ||
|
||
test "raises if configured with invalid client secret" do | ||
assert_raise(Pigeon.ConfigError, @invalid_key_msg, fn -> | ||
config = Pigeon.ADM.Config.new(name: :test, client_id: "amzn1.iba-client.abc123", client_secret: nil) | ||
Pigeon.ADM.Worker.init({:ok, config}) | ||
end) | ||
end | ||
end |
Oops, something went wrong.