Skip to content

Commit

Permalink
put some documentation in the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
benwilson512 committed May 8, 2015
1 parent de381d5 commit 11ed761
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ end
Now we hop over to the `ExAws.Dynamo.Impl` module where we actually format the request:
```elixir
def describe_table(client, name) do
%{TableName: name}
%{"TableName" => name}
|> client.request(:describe_table)
end
```
Expand Down
3 changes: 3 additions & 0 deletions lib/ex_aws/dynamo/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ defmodule ExAws.Dynamo.Client do
By default you can use ExAws.Dynamo
NOTE: When Mix.env in [:test, :dev] dynamo clients will run by default against
Dynamodb local.
## Usage
```
defmodule MyApp.Dynamo do
Expand Down
7 changes: 7 additions & 0 deletions test/lib/ex_aws/dynamo/integration_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ defmodule ExAws.DynamoIntegrationTest do
alias ExAws.Dynamo.Decoder
use ExUnit.Case, async: true

## These tests run against DynamoDb Local
#
# http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Tools.DynamoDBLocal.html
# In this way they can safely delete data and tables without risking actual data on
# Dynamo
#

setup_all do
Dynamo.delete_table("Users")
Dynamo.delete_table(Test.User)
Expand Down
7 changes: 6 additions & 1 deletion test/lib/ex_aws/dynamo_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ defmodule ExAws.DynamoTest do
use ExUnit.Case, async: true
alias Test.Dummy.Dynamo

## NOTE:
# These tests are not intended to be operational examples, but intead mere
# ensure that the form of the data to be sent to AWS is correct.
#

test "#scan" do
expected = %{"ExclusiveStartKey" => %{api_key: %{"S" => "api_key"}}, "ExpressionAttributeNames" => %{api_key: "#api_key"},
"ExpressionAttributeValues" => %{":api_key" => %{"S" => "asdfasdfasdf"}, ":name" => %{"S" => "bubba"}},
Expand All @@ -28,7 +33,7 @@ defmodule ExAws.DynamoTest do
"ExpressionAttributeValues" => %{":api_key" => %{"S" => "asdfasdfasdf"}, ":name" => %{"S" => "bubba"}},
"FilterExpression" => "ApiKey = #api_key and Name = :name", "Limit" => 12, "TableName" => "Users"}

assert Dynamo.scan("Users",
assert Dynamo.query("Users",
limit: 12,
exclusive_start_key: [api_key: "api_key"],
expression_attribute_names: [api_key: "#api_key"],
Expand Down
7 changes: 6 additions & 1 deletion test/lib/ex_aws/kinesis/integration_test.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
defmodule ExAws.KinesisTest do
defmodule ExAws.KinesisIntegrationTest do
use ExUnit.Case, async: true

# NOTE
# These tests run against the actual Kinesis service.
# No functions should be called that in any way alter state.
#

test "#list_streams" do
assert {:ok, %{"HasMoreStreams" => _, "StreamNames" => _}} = Test.Kinesis.list_streams
end
Expand Down
5 changes: 5 additions & 0 deletions test/lib/ex_aws/kinesis_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ defmodule ExAws.KinesisTest do
use ExUnit.Case, async: true
alias Test.Dummy.Kinesis

## NOTE:
# These tests are not intended to be operational examples, but intead mere
# ensure that the form of the data to be sent to AWS is correct.
#

test "#put_records" do
records = [
%{data: "asdfasdfasdf", partition_key: "foo"},
Expand Down

0 comments on commit 11ed761

Please sign in to comment.