Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
vincbeck committed Jul 29, 2024
1 parent 7a5ffcc commit ebf239c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/providers/amazon/aws/operators/test_emr_serverless.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,27 @@ def test_start_job_deferrable(self, mock_conn):
with pytest.raises(TaskDeferred):
operator.execute(self.mock_context)

@mock.patch.object(EmrServerlessHook, "conn")
def test_start_job_deferrable_without_wait_for_completion(self, mock_conn):
mock_conn.get_application.return_value = {"application": {"state": "STARTED"}}
mock_conn.start_job_run.return_value = {
"jobRunId": job_run_id,
"ResponseMetadata": {"HTTPStatusCode": 200},
}
operator = EmrServerlessStartJobOperator(
task_id=task_id,
application_id=application_id,
execution_role_arn=execution_role_arn,
job_driver=job_driver,
configuration_overrides=configuration_overrides,
deferrable=True,
wait_for_completion=False,
)

result = operator.execute(self.mock_context)

assert result == job_run_id

@mock.patch.object(EmrServerlessHook, "get_waiter")
@mock.patch.object(EmrServerlessHook, "conn")
def test_start_job_deferrable_app_not_started(self, mock_conn, mock_get_waiter):
Expand Down

0 comments on commit ebf239c

Please sign in to comment.