Refactored tests to use fake_uuid

This commit is contained in:
Ken Tsang
2017-03-22 14:31:16 +00:00
parent ecbe87a0d6
commit 41f82c0aef
2 changed files with 4 additions and 8 deletions

View File

@@ -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

View File

@@ -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])