[tests] Add fixture to create email rows

This commit is contained in:
maike 2020-07-11 04:28:17 +02:00 committed by dl6tom
parent 10c496af98
commit 4a2ed681ca

View file

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