def test_delete_by_email(context): user = User.create_user('ramadan', '*****@*****.**', 'pass1234') User.delete_by_email('wrong').should.equal((False, {})) User.delete_by_email('*****@*****.**').should.equal((True, { 'first_name': 'ramadan', 'email': '*****@*****.**', 'uuid': user.uuid, })) User.query.filter_by(email='*****@*****.**').first().should.equal(None)
def api_user_delete_by_email(email): is_deleted, data = User.delete_by_email(email) if not is_deleted: return json_response({}, 404) return json_response(data, 200)