Added delete endpoint and tests.

This commit is contained in:
Nicholas Staples
2016-01-12 10:39:49 +00:00
parent 752a359d3d
commit 31f10c7457
8 changed files with 88 additions and 29 deletions

View File

@@ -195,3 +195,15 @@ def test_get_user_service_service_not_exists(notify_api, notify_db, notify_db_se
assert resp.status_code == 404
json_resp = json.loads(resp.get_data(as_text=True))
assert "Service not found" in json_resp['message']
def test_delete_user(notify_api, notify_db, notify_db_session, sample_user):
with notify_api.test_request_context():
with notify_api.test_client() as client:
user = User.query.first()
resp = client.delete(
url_for('user.update_user', user_id=user.id),
headers=[('Content-Type', 'application/json')])
assert resp.status_code == 202
json_resp = json.loads(resp.get_data(as_text=True))
assert User.query.count() == 0