tests: re-enable a test on job api (#63192)

This commit is contained in:
Nicolas Roche 2022-09-07 16:27:33 +02:00
parent 686db642f5
commit 88abc88953
1 changed files with 4 additions and 3 deletions

View File

@ -42,11 +42,11 @@ def connector(db):
return connector
@pytest.mark.xfail(run=False)
@mock.patch('passerelle.sms.models.SMSResource.send_job')
def test_api_jobs(mocked_send_job, app, connector, simple_user, admin_user):
def test_api_jobs(mocked_send_job, app, connector, simple_user, admin_user, freezer):
assert Job.objects.count() == 0
url = reverse('api-job', kwargs={'pk': 22})
freezer.move_to('2022-01-01 12:00')
# no job
resp = app.get(url, status=200)
@ -84,6 +84,7 @@ def test_api_jobs(mocked_send_job, app, connector, simple_user, admin_user):
update_timestamp1 = resp.json['data']['update_timestamp']
# completed job
freezer.move_to('2022-01-01 12:01')
connector.jobs()
assert mocked_send_job.call_args == mock.call(my_parameter='my_value')
resp = app.get(url, status=200)
@ -91,7 +92,7 @@ def test_api_jobs(mocked_send_job, app, connector, simple_user, admin_user):
assert resp.json['data']['id'] == job.id
assert resp.json['data']['status'] == 'completed'
assert resp.json['data']['done_timestamp'] is not None
assert resp.json['data']['update_timestamp'] < update_timestamp1
assert resp.json['data']['update_timestamp'] > update_timestamp1
# failed job
job = connector.add_job('send_job')