[tests] Add fixture to create email rows
This commit is contained in:
parent
10c496af98
commit
4a2ed681ca
|
@ -84,7 +84,7 @@ def hood_id(client, auth_header):
|
||||||
@fixture(scope='function')
|
@fixture(scope='function')
|
||||||
def trigger_id(client, hood_id, auth_header):
|
def trigger_id(client, hood_id, auth_header):
|
||||||
response = client.post(
|
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
|
assert response.status_code == status.HTTP_201_CREATED
|
||||||
trigger_id = int(response.headers['Location'])
|
trigger_id = int(response.headers['Location'])
|
||||||
|
@ -116,3 +116,14 @@ def test_id(client, hood_id, auth_header):
|
||||||
test_id = int(response.headers['Location'])
|
test_id = int(response.headers['Location'])
|
||||||
yield test_id
|
yield test_id
|
||||||
client.delete('/api/hoods/%d/test/%d' % (hood_id, test_id), headers=auth_header)
|
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)
|
||||||
|
|
Loading…
Reference in a new issue