def test_report_job_status(make_stubber, done_status): s3control_stubber = make_stubber(batch_versioning.s3control) account_id = 'test-account-id' job_id = 'test-job-id' s3control_stubber.stub_describe_job(account_id, job_id, status='Preparing') s3control_stubber.stub_describe_job(account_id, job_id, status='Preparing') s3control_stubber.stub_describe_job(account_id, job_id, status=done_status) batch_versioning.report_job_status(account_id, job_id)
def test_report_job_status_failure(make_stubber): s3control_stubber = make_stubber(batch_versioning.s3control) account_id = 'test-account-id' job_id = 'test-job-id' s3control_stubber.stub_describe_job(account_id, job_id, error_code='TestException') with pytest.raises(ClientError) as exc_info: batch_versioning.report_job_status(account_id, job_id) assert exc_info.value.response['Error']['Code'] == 'TestException'