Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@

BASE_TRIGGER_CLASSPATH = "airflow.providers.amazon.aws.triggers.bedrock."

pytest.importorskip("aiobotocore")


class TestBaseBedrockTrigger:
EXPECTED_WAITER_NAME: str | None = None
Expand All @@ -58,7 +56,7 @@ def test_serialization(self):

@pytest.mark.asyncio
@mock.patch.object(BedrockHook, "get_waiter")
@mock.patch.object(BedrockHook, "async_conn")
@mock.patch.object(BedrockHook, "get_async_conn")
async def test_run_success(self, mock_async_conn, mock_get_waiter):
mock_async_conn.__aenter__.return_value = mock.MagicMock()
mock_get_waiter().wait = AsyncMock()
Expand Down Expand Up @@ -87,7 +85,7 @@ def test_serialization(self):

@pytest.mark.asyncio
@mock.patch.object(BedrockHook, "get_waiter")
@mock.patch.object(BedrockHook, "async_conn")
@mock.patch.object(BedrockHook, "get_async_conn")
async def test_run_success(self, mock_async_conn, mock_get_waiter):
mock_async_conn.__aenter__.return_value = mock.MagicMock()
mock_get_waiter().wait = AsyncMock()
Expand Down Expand Up @@ -118,7 +116,7 @@ def test_serialization(self):

@pytest.mark.asyncio
@mock.patch.object(BedrockAgentHook, "get_waiter")
@mock.patch.object(BedrockAgentHook, "async_conn")
@mock.patch.object(BedrockAgentHook, "get_async_conn")
async def test_run_success(self, mock_async_conn, mock_get_waiter):
mock_async_conn.__aenter__.return_value = mock.MagicMock()
mock_get_waiter().wait = AsyncMock()
Expand Down Expand Up @@ -154,7 +152,7 @@ def test_serialization(self):

@pytest.mark.asyncio
@mock.patch.object(BedrockAgentHook, "get_waiter")
@mock.patch.object(BedrockAgentHook, "async_conn")
@mock.patch.object(BedrockAgentHook, "get_async_conn")
async def test_run_success(self, mock_async_conn, mock_get_waiter):
mock_async_conn.__aenter__.return_value = mock.MagicMock()
mock_get_waiter().wait = AsyncMock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@

BASE_TRIGGER_CLASSPATH = "airflow.providers.amazon.aws.triggers.comprehend."

pytest.importorskip("aiobotocore")


class TestBaseComprehendTrigger:
EXPECTED_WAITER_NAME: str | None = None
Expand All @@ -58,7 +56,7 @@ def test_serialization(self):

@pytest.mark.asyncio
@mock.patch.object(ComprehendHook, "get_waiter")
@mock.patch.object(ComprehendHook, "async_conn")
@mock.patch.object(ComprehendHook, "get_async_conn")
async def test_run_success(self, mock_async_conn, mock_get_waiter):
mock_async_conn.__aenter__.return_value = mock.MagicMock()
mock_get_waiter().wait = AsyncMock()
Expand Down Expand Up @@ -89,7 +87,7 @@ def test_serialization(self):

@pytest.mark.asyncio
@mock.patch.object(ComprehendHook, "get_waiter")
@mock.patch.object(ComprehendHook, "async_conn")
@mock.patch.object(ComprehendHook, "get_async_conn")
async def test_run_success(self, mock_async_conn, mock_get_waiter):
mock_async_conn.__aenter__.return_value = mock.MagicMock()
mock_get_waiter().wait = AsyncMock()
Expand Down
12 changes: 5 additions & 7 deletions providers/amazon/tests/unit/amazon/aws/triggers/test_dms.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@

BASE_TRIGGER_CLASSPATH = "airflow.providers.amazon.aws.triggers.dms."

pytest.importorskip("aiobotocore")


class TestBaseDmsTrigger:
EXPECTED_WAITER_NAME: str | None = None
Expand All @@ -59,7 +57,7 @@ def test_serialization(self):

@pytest.mark.asyncio
@mock.patch.object(DmsHook, "get_waiter")
@mock.patch.object(DmsHook, "get_conn")
@mock.patch.object(DmsHook, "get_async_conn")
async def test_complete(self, mock_async_conn, mock_get_waiter):
mock_async_conn.__aenter__.return_value = mock.MagicMock()
mock_get_waiter().wait = AsyncMock()
Expand All @@ -86,7 +84,7 @@ def test_serialization(self):

@pytest.mark.asyncio
@mock.patch.object(DmsHook, "get_waiter")
@mock.patch.object(DmsHook, "get_conn")
@mock.patch.object(DmsHook, "get_async_conn")
async def test_complete(self, mock_async_conn, mock_get_waiter):
mock_async_conn.__aenter__.return_value = mock.MagicMock()
mock_get_waiter().wait = AsyncMock()
Expand Down Expand Up @@ -115,7 +113,7 @@ def test_serialization(self):

@pytest.mark.asyncio
@mock.patch.object(DmsHook, "get_waiter")
@mock.patch.object(DmsHook, "get_conn")
@mock.patch.object(DmsHook, "get_async_conn")
async def test_complete(self, mock_async_conn, mock_get_waiter):
mock_async_conn.__aenter__.return_value = mock.MagicMock()
mock_get_waiter().wait = AsyncMock()
Expand Down Expand Up @@ -147,7 +145,7 @@ def test_serialization(self):

@pytest.mark.asyncio
@mock.patch.object(DmsHook, "get_waiter")
@mock.patch.object(DmsHook, "get_conn")
@mock.patch.object(DmsHook, "get_async_conn")
async def test_complete(self, mock_async_conn, mock_get_waiter):
mock_async_conn.__aenter__.return_value = mock.MagicMock()
mock_get_waiter().wait = AsyncMock()
Expand Down Expand Up @@ -175,7 +173,7 @@ def test_serialization(self):

@pytest.mark.asyncio
@mock.patch.object(DmsHook, "get_waiter")
@mock.patch.object(DmsHook, "get_conn")
@mock.patch.object(DmsHook, "get_async_conn")
async def test_complete(self, mock_async_conn, mock_get_waiter):
mock_async_conn.__aenter__.return_value = mock.MagicMock()
mock_get_waiter().wait = AsyncMock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@

BASE_TRIGGER_CLASSPATH = "airflow.providers.amazon.aws.triggers.glue."

pytest.importorskip("aiobotocore")


class TestGlueJobTrigger:
@pytest.mark.asyncio
Expand Down Expand Up @@ -155,7 +153,7 @@ def test_serialization(self):

@pytest.mark.asyncio
@mock.patch.object(GlueDataQualityHook, "get_waiter")
@mock.patch.object(GlueDataQualityHook, "async_conn")
@mock.patch.object(GlueDataQualityHook, "get_async_conn")
async def test_run_success(self, mock_async_conn, mock_get_waiter):
mock_async_conn.__aenter__.return_value = mock.MagicMock()
mock_get_waiter().wait = AsyncMock()
Expand All @@ -182,7 +180,7 @@ def test_serialization(self):

@pytest.mark.asyncio
@mock.patch.object(GlueDataQualityHook, "get_waiter")
@mock.patch.object(GlueDataQualityHook, "async_conn")
@mock.patch.object(GlueDataQualityHook, "get_async_conn")
async def test_run_success(self, mock_async_conn, mock_get_waiter):
mock_async_conn.__aenter__.return_value = mock.MagicMock()
mock_get_waiter().wait = AsyncMock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
from airflow.triggers.base import TriggerEvent
from unit.amazon.aws.utils.test_waiter import assert_expected_waiter_type

pytest.importorskip("aiobotocore")


class TestGlueCrawlerCompleteTrigger:
def test_serialization(self):
Expand All @@ -52,7 +50,7 @@ def test_serialization(self):

@pytest.mark.asyncio
@mock.patch.object(GlueCrawlerHook, "get_waiter")
@mock.patch.object(GlueCrawlerHook, "async_conn")
@mock.patch.object(GlueCrawlerHook, "get_async_conn")
async def test_run_success(self, mock_async_conn, mock_get_waiter):
mock_async_conn.__aenter__.return_value = mock.MagicMock()
mock_get_waiter().wait = AsyncMock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@

BASE_TRIGGER_CLASSPATH = "airflow.providers.amazon.aws.triggers.kinesis_analytics."

pytest.importorskip("aiobotocore")


class TestKinesisAnalyticsV2ApplicationOperationCompleteTrigger:
APPLICATION_NAME = "demo"
Expand All @@ -47,7 +45,7 @@ def test_serialization(self):

@pytest.mark.asyncio
@mock.patch.object(KinesisAnalyticsV2Hook, "get_waiter")
@mock.patch.object(KinesisAnalyticsV2Hook, "async_conn")
@mock.patch.object(KinesisAnalyticsV2Hook, "get_async_conn")
async def test_run_success_with_application_start_complete_waiter(self, mock_async_conn, mock_get_waiter):
mock_async_conn.__aenter__.return_value = mock.MagicMock()
mock_get_waiter().wait = AsyncMock()
Expand All @@ -64,7 +62,7 @@ async def test_run_success_with_application_start_complete_waiter(self, mock_asy

@pytest.mark.asyncio
@mock.patch.object(KinesisAnalyticsV2Hook, "get_waiter")
@mock.patch.object(KinesisAnalyticsV2Hook, "async_conn")
@mock.patch.object(KinesisAnalyticsV2Hook, "get_async_conn")
async def test_run_success_with_application_stop_complete_waiter(self, mock_async_conn, mock_get_waiter):
mock_async_conn.__aenter__.return_value = mock.MagicMock()
mock_get_waiter().wait = AsyncMock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@

BASE_TRIGGER_CLASSPATH = "airflow.providers.amazon.aws.triggers.opensearch_serverless."

pytest.importorskip("aiobotocore")


class TestBaseBedrockTrigger(TestAwsBaseWaiterTrigger):
EXPECTED_WAITER_NAME: str | None = None
Expand Down Expand Up @@ -77,7 +75,7 @@ def test_serialization(self, collection_name, collection_id, expected_pass):

@pytest.mark.asyncio
@mock.patch.object(OpenSearchServerlessHook, "get_waiter")
@mock.patch.object(OpenSearchServerlessHook, "async_conn")
@mock.patch.object(OpenSearchServerlessHook, "get_async_conn")
async def test_run_success(self, mock_async_conn, mock_get_waiter):
mock_async_conn.__aenter__.return_value = mock.MagicMock()
mock_get_waiter().wait = AsyncMock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@
AWS_REGION = "us-east-2"


pytest.importorskip("aiobotocore")


def gen_test_name(trigger):
"""Gives to tests the name of the class being tested."""
return trigger.__class__.__name__
Expand Down
Loading