From 23c7ac2c34b63dde4d18cef05924a3a50abfc711 Mon Sep 17 00:00:00 2001 From: Luna Date: Fri, 10 May 2019 17:27:54 -0300 Subject: [PATCH] test_admin_api.test_users: properly delete test users --- tests/test_admin_api/test_users.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_admin_api/test_users.py b/tests/test_admin_api/test_users.py index 832fb9b..fc911cb 100644 --- a/tests/test_admin_api/test_users.py +++ b/tests/test_admin_api/test_users.py @@ -84,8 +84,12 @@ async def _del_user(test_cli, user_id, *, token=None): assert rjson['new']['id'] == user_id assert rjson['old']['id'] == rjson['new']['id'] - # TODO: remove from database at this point? it'll just keep being - # filled up every time we run a test.. + # delete the original record since the DELETE endpoint will just + # replace the user by a "Deleted User ", and we don't want + # to have obsolete users filling up our db every time we run tests + await test_cli.app.db.execute(""" + DELETE FROM users WHERE id = $1 + """, int(user_id)) @pytest.mark.asyncio