Skip to content

Commit

Permalink
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] authored and benjamin-awd committed Oct 6, 2023
1 parent c2315d3 commit f27655a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cosmos/profiles/athena/access_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class AthenaAccessKeyProfileMapping(BaseProfileMapping):
"""
Maps Airflow AWS connections to a dbt Athena profile using an access key id and secret access key.
https://docs.getdbt.com/docs/core/connect-data-platform/athena-setup
https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/connections/aws.html
"""
Expand Down
9 changes: 7 additions & 2 deletions tests/profiles/athena/test_athena_access_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ def mock_athena_conn(): # type: ignore
"s3_staging_dir": "s3://my_bucket/dbt/",
"schema": "my_schema",
}
)
),
)

with patch("airflow.hooks.base.BaseHook.get_connection", return_value=conn):
yield conn


def test_athena_connection_claiming() -> None:
"""
Tests that the Athena profile mapping claims the correct connection type.
Expand All @@ -57,7 +58,7 @@ def test_athena_connection_claiming() -> None:
"s3_staging_dir": "s3://my_bucket/dbt/",
"schema": "my_schema",
}
)
),
}

# if we're missing any of the values, it shouldn't claim
Expand All @@ -79,6 +80,7 @@ def test_athena_connection_claiming() -> None:
profile_mapping = AthenaAccessKeyProfileMapping(conn, {})
assert profile_mapping.can_claim_connection()


def test_athena_profile_mapping_selected(
mock_athena_conn: Connection,
) -> None:
Expand All @@ -90,6 +92,7 @@ def test_athena_profile_mapping_selected(
)
assert isinstance(profile_mapping, AthenaAccessKeyProfileMapping)


def test_athena_profile_args(
mock_athena_conn: Connection,
) -> None:
Expand All @@ -110,6 +113,7 @@ def test_athena_profile_args(
"schema": mock_athena_conn.extra_dejson.get("schema"),
}


def test_athena_profile_args_overrides(
mock_athena_conn: Connection,
) -> None:
Expand All @@ -135,6 +139,7 @@ def test_athena_profile_args_overrides(
"schema": "my_custom_schema",
}


def test_athena_profile_env_vars(
mock_athena_conn: Connection,
) -> None:
Expand Down

0 comments on commit f27655a

Please sign in to comment.