Skip to content

Commit

Permalink
fix: default region to get ExAws region
Browse files Browse the repository at this point in the history
  • Loading branch information
marciotoze committed Feb 5, 2021
1 parent 82c3ff3 commit 6bdaa5c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ config :ex_aws_configurator,
}
},
topics: %{
an_topic: %{environment: "test", prefix: "prefix", region: "us-east-1"},
an_topic: %{environment: nil},
another_topic: %{environment: "teste", prefix: "prefixo", region: "sa-east-1"}
}
2 changes: 1 addition & 1 deletion lib/ex_aws_configurator/queue.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defmodule ExAwsConfigurator.Queue do

defstruct name: nil,
environment: Mix.env(),
region: nil,
region: ExAws.Config.new(:sqs).region,
prefix: nil,
attributes: [
fifo_queue: false,
Expand Down
2 changes: 1 addition & 1 deletion lib/ex_aws_configurator/topic.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule ExAwsConfigurator.Topic do

defstruct name: nil,
environment: Mix.env(),
region: nil,
region: ExAws.Config.new(:sns).region,
prefix: nil

@doc false
Expand Down
6 changes: 6 additions & 0 deletions test/ex_aws_configurator/sns_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ defmodule ExAwsConfigurator.SNSTest do

setup do
add_topic_to_config(build(:topic_config, name: :topic_name))
add_topic_to_config(%{topic_min_config: %{}})

SNS.create_topic(:topic_min_config)
SNS.create_topic(:topic_name)

add_topic_to_config(build(:topic_config, name: :non_created_topic))
Expand All @@ -20,6 +22,10 @@ defmodule ExAwsConfigurator.SNSTest do
assert {:ok, %{status_code: 200}} = SNS.create_topic(:topic_name)
end

test "create topic with min attributes" do
assert {:ok, %{status_code: 200}} = SNS.create_topic(:topic_min_config)
end

test "create topic when receive a Topic with correct configuration" do
topic = ExAwsConfigurator.get_topic(:topic_name)

Expand Down
6 changes: 6 additions & 0 deletions test/ex_aws_configurator/sqs_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ defmodule ExAwsConfigurator.SQSTest do

setup do
add_queue_to_config(build(:queue_config, name: :queue_name))
add_queue_to_config(%{queue_min_config: %{}})
add_topic_to_config(build(:topic_config, name: :topic_name))

SQS.create_queue(:queue_min_config)
SQS.create_queue(:queue_name)
SNS.create_topic(:topic_name)

Expand All @@ -22,6 +24,10 @@ defmodule ExAwsConfigurator.SQSTest do
assert {:ok, %{status_code: 200}} = SQS.create_queue(:queue_name)
end

test "create queue with min attributes" do
assert {:ok, %{status_code: 200}} = SQS.create_queue(:queue_min_config)
end

test "create queue when receive a struct with correct configuration" do
queue = ExAwsConfigurator.get_queue(:queue_name)

Expand Down

0 comments on commit 6bdaa5c

Please sign in to comment.