Skip to content

Commit

Permalink
Update decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Apr 12, 2024
1 parent 0ac75c5 commit f3a9f51
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
17 changes: 8 additions & 9 deletions tests/test_boto_connector.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from unittest.mock import patch

from moto import mock_dynamodb, mock_sts
from moto import mock_aws

from tap_dynamodb.connectors.aws_boto_connector import AWSBotoConnector

Expand All @@ -9,7 +9,7 @@
"tap_dynamodb.connectors.aws_boto_connector.boto3.Session",
return_value="mock_session",
)
@mock_dynamodb
@mock_aws
def test_get_session_base(patch):
auth = AWSBotoConnector(
{
Expand All @@ -32,7 +32,7 @@ def test_get_session_base(patch):
"tap_dynamodb.connectors.aws_boto_connector.boto3.Session",
return_value="mock_session",
)
@mock_dynamodb
@mock_aws
def test_get_session_w_token(patch):
auth = AWSBotoConnector(
{
Expand All @@ -57,7 +57,7 @@ def test_get_session_w_token(patch):
"tap_dynamodb.connectors.aws_boto_connector.boto3.Session",
return_value="mock_session",
)
@mock_dynamodb
@mock_aws
def test_get_session_w_profile(patch):
auth = AWSBotoConnector(
{
Expand All @@ -76,16 +76,15 @@ def test_get_session_w_profile(patch):
"tap_dynamodb.connectors.aws_boto_connector.boto3.Session",
return_value="mock_session",
)
@mock_dynamodb
@mock_aws
def test_get_session_implicit(patch):
auth = AWSBotoConnector({}, "dynamodb")
session = auth.get_session()
patch.assert_called_with()
assert session == "mock_session"


@mock_dynamodb
@mock_sts
@mock_aws
def test_get_session_assume_role():
auth = AWSBotoConnector(
{
Expand All @@ -99,7 +98,7 @@ def test_get_session_assume_role():
auth.get_session()


@mock_dynamodb
@mock_aws
def test_get_client():
auth = AWSBotoConnector(
{
Expand All @@ -113,7 +112,7 @@ def test_get_client():
auth.get_client(session, "dynamodb")


@mock_dynamodb
@mock_aws
def test_get_resource():
auth = AWSBotoConnector(
{
Expand Down
20 changes: 10 additions & 10 deletions tests/test_dynamodb_connector.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import boto3
from moto import mock_dynamodb
from moto import mock_aws

from tap_dynamodb.dynamodb_connector import DynamoDbConnector

Expand All @@ -25,7 +25,7 @@ def create_table(moto_conn, name):
)


@mock_dynamodb
@mock_aws
def test_list_tables():
# PREP
moto_conn = boto3.resource("dynamodb", region_name="us-west-2")
Expand All @@ -40,7 +40,7 @@ def test_list_tables():
assert tables[-1] == "table_105"


@mock_dynamodb
@mock_aws
def test_list_tables_filtered():
# PREP
moto_conn = boto3.resource("dynamodb", region_name="us-west-2")
Expand All @@ -59,7 +59,7 @@ def test_list_tables_filtered():
assert len(tables) == 0


@mock_dynamodb
@mock_aws
def test_get_items():
# PREP
moto_conn = boto3.resource("dynamodb", region_name="us-west-2")
Expand All @@ -76,7 +76,7 @@ def test_get_items():
assert records[0].get("info") == {"plot": "bar"}


@mock_dynamodb
@mock_aws
def test_get_items_w_kwargs():
# PREP
moto_conn = boto3.resource("dynamodb", region_name="us-west-2")
Expand All @@ -97,7 +97,7 @@ def test_get_items_w_kwargs():
assert records[0].get("info") == {"plot": "bar"}


@mock_dynamodb
@mock_aws
def test_get_items_paginate():
# PREP
moto_conn = boto3.resource("dynamodb", region_name="us-west-2")
Expand All @@ -122,7 +122,7 @@ def test_get_items_paginate():
assert first_item.get("info") == {"plot": "bar"}


@mock_dynamodb
@mock_aws
def test_get_table_json_schema():
# PREP
moto_conn = boto3.resource("dynamodb", region_name="us-west-2")
Expand All @@ -145,7 +145,7 @@ def test_get_table_json_schema():
}


@mock_dynamodb
@mock_aws
def test_get_table_json_schema_w_kwargs():
# PREP
moto_conn = boto3.resource("dynamodb", region_name="us-west-2")
Expand All @@ -171,7 +171,7 @@ def test_get_table_json_schema_w_kwargs():
}


@mock_dynamodb
@mock_aws
def test_get_table_key_properties():
# PREP
moto_conn = boto3.resource("dynamodb", region_name="us-west-2")
Expand All @@ -194,7 +194,7 @@ def test_coerce_types():
assert coerced == {"foo": "1.23"}


@mock_dynamodb
@mock_aws
def test_get_sample_records():
# PREP
moto_conn = boto3.resource("dynamodb", region_name="us-west-2")
Expand Down

0 comments on commit f3a9f51

Please sign in to comment.