mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-21 07:51:13 -05:00
Refactored tests to use fake_uuid
This commit is contained in:
@@ -41,12 +41,10 @@ def test_get_email_template_by_id_returns_200(client, sample_service, tmp_type,
|
|||||||
assert json_response == expected_response
|
assert json_response == expected_response
|
||||||
|
|
||||||
|
|
||||||
def test_get_template_with_non_existent_template_id_returns_404(client, sample_service):
|
def test_get_template_with_non_existent_template_id_returns_404(client, fake_uuid, sample_service):
|
||||||
auth_header = create_authorization_header(service_id=sample_service.id)
|
auth_header = create_authorization_header(service_id=sample_service.id)
|
||||||
|
|
||||||
random_template_id = str(uuid.uuid4())
|
response = client.get(path='/v2/template/{}'.format(fake_uuid),
|
||||||
|
|
||||||
response = client.get(path='/v2/template/{}'.format(random_template_id),
|
|
||||||
headers=[('Content-Type', 'application/json'), auth_header])
|
headers=[('Content-Type', 'application/json'), auth_header])
|
||||||
|
|
||||||
assert response.status_code == 404
|
assert response.status_code == 404
|
||||||
|
|||||||
@@ -57,13 +57,11 @@ def test_invalid_post_template_returns_400(client, sample_service, tmp_type):
|
|||||||
assert 'Missing personalisation: Missing' in resp_json['errors'][0]['message']
|
assert 'Missing personalisation: Missing' in resp_json['errors'][0]['message']
|
||||||
|
|
||||||
|
|
||||||
def test_post_template_with_non_existent_template_id_returns_404(client, sample_service):
|
def test_post_template_with_non_existent_template_id_returns_404(client, fake_uuid, sample_service):
|
||||||
auth_header = create_authorization_header(service_id=sample_service.id)
|
auth_header = create_authorization_header(service_id=sample_service.id)
|
||||||
|
|
||||||
random_template_id = str(uuid.uuid4())
|
|
||||||
|
|
||||||
response = client.post(
|
response = client.post(
|
||||||
path='/v2/template/{}/preview'.format(random_template_id),
|
path='/v2/template/{}/preview'.format(fake_uuid),
|
||||||
data=json.dumps(valid_data),
|
data=json.dumps(valid_data),
|
||||||
headers=[('Content-Type', 'application/json'), auth_header])
|
headers=[('Content-Type', 'application/json'), auth_header])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user