ferruzzi commented on code in PR #32274:
URL: https://github.com/apache/airflow/pull/32274#discussion_r1253597610
##########
tests/providers/amazon/aws/triggers/test_batch.py:
##########
@@ -39,186 +31,34 @@
pytest.importorskip("aiobotocore")
-class TestBatchOperatorTrigger:
- def test_batch_operator_trigger_serialize(self):
- batch_trigger = BatchOperatorTrigger(
- job_id=BATCH_JOB_ID,
- poll_interval=POLL_INTERVAL,
- max_retries=MAX_ATTEMPT,
- aws_conn_id=AWS_CONN_ID,
- region_name=AWS_REGION,
- )
- class_path, args = batch_trigger.serialize()
- assert class_path ==
"airflow.providers.amazon.aws.triggers.batch.BatchOperatorTrigger"
- assert args["job_id"] == BATCH_JOB_ID
- assert args["poll_interval"] == POLL_INTERVAL
- assert args["max_retries"] == MAX_ATTEMPT
- assert args["aws_conn_id"] == AWS_CONN_ID
- assert args["region_name"] == AWS_REGION
-
- @pytest.mark.asyncio
-
@mock.patch("airflow.providers.amazon.aws.hooks.batch_client.BatchClientHook.get_waiter")
-
@mock.patch("airflow.providers.amazon.aws.hooks.batch_client.BatchClientHook.async_conn")
- async def test_batch_job_trigger_run(self, mock_async_conn,
mock_get_waiter):
- the_mock = mock.MagicMock()
- mock_async_conn.__aenter__.return_value = the_mock
-
- mock_get_waiter().wait = AsyncMock()
-
- batch_trigger = BatchOperatorTrigger(
- job_id=BATCH_JOB_ID,
- poll_interval=POLL_INTERVAL,
- max_retries=MAX_ATTEMPT,
- aws_conn_id=AWS_CONN_ID,
- region_name=AWS_REGION,
- )
-
- generator = batch_trigger.run()
- response = await generator.asend(None)
-
- assert response == TriggerEvent({"status": "success", "job_id":
BATCH_JOB_ID})
-
-
-class TestBatchSensorTrigger:
- TRIGGER = BatchSensorTrigger(
- job_id=BATCH_JOB_ID,
- region_name=AWS_REGION,
- aws_conn_id=AWS_CONN_ID,
- poke_interval=POLL_INTERVAL,
+class TestBatchTrigger:
+ @pytest.mark.parametrize(
Review Comment:
:chefkiss:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]