From 4a2ed681ca2db4bca3aa5678c8dd0edd3296b7aa Mon Sep 17 00:00:00 2001 From: maike Date: Sat, 11 Jul 2020 04:28:17 +0200 Subject: [PATCH] [tests] Add fixture to create email rows --- tests/conftest.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 67020b3..c3d80a0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -84,7 +84,7 @@ def hood_id(client, auth_header): @fixture(scope='function') def trigger_id(client, hood_id, auth_header): response = client.post( - '/api/hoods/%d/triggers/' % hood_id, json={'pattern': ''}, headers=auth_header + '/api/hoods/%d/triggers/' % hood_id, json={'pattern': 'te'}, headers=auth_header ) assert response.status_code == status.HTTP_201_CREATED trigger_id = int(response.headers['Location']) @@ -116,3 +116,14 @@ def test_id(client, hood_id, auth_header): test_id = int(response.headers['Location']) yield test_id client.delete('/api/hoods/%d/test/%d' % (hood_id, test_id), headers=auth_header) + + +@fixture(scope="function") +def email_row(client, hood_id, auth_header): + response = client.post('/api/hoods/%d/email/' % hood_id, headers=auth_header) + assert response.status_code == status.HTTP_201_CREATED + assert response.json()["hood"]["id"] == hood_id + email_row = response.json() + yield email_row + # not sure if necessary; it raises problems at least + # client.delete('/api/hoods/%d/email/' % hood_id, headers=auth_header)