User can cancel a letter job - happy path

This commit is contained in:
Pea Tyczynska
2019-06-18 15:52:29 +01:00
parent e751f57dc4
commit ab953896ab
4 changed files with 62 additions and 2 deletions

View File

@@ -1,6 +1,8 @@
import json
import pytest
import uuid
from flask import url_for
from freezegun import freeze_time
@@ -486,6 +488,26 @@ def test_should_not_show_cancelled_job(
)
def test_should_cancel_letter_job(
client_request,
mocker,
):
job_id = uuid.uuid4()
mock_cancel = mocker.patch('app.main.jobs.job_api_client.cancel_letter_job')
client_request.post(
'main.cancel_letter_job',
service_id=SERVICE_ONE_ID,
job_id=job_id,
_expected_status=302,
_expected_redirect=url_for(
'main.service_dashboard',
service_id=SERVICE_ONE_ID,
_external=True,
)
)
mock_cancel.assert_called_once_with(SERVICE_ONE_ID, job_id)
@freeze_time("2016-01-01 00:00:00.000001")
def test_should_show_updates_for_one_job_as_json(
logged_in_client,