Skip to content

Commit 46d3ab8

Browse files
committed
Integration tests for user delete helpers
add test for user email modified when deleted Add tests for user delete restore Hound Issues
1 parent af2ee84 commit 46d3ab8

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import unittest
2+
from app import current_app as app
3+
from tests.all.integration.auth_helper import create_user
4+
from app.api.helpers.user import modify_email_for_user_to_be_deleted, \
5+
modify_email_for_user_to_be_restored
6+
from app.api.helpers.db import save_to_db
7+
8+
from tests.all.integration.utils import OpenEventTestCase
9+
from tests.all.integration.setup_database import Setup
10+
11+
12+
class TestUserUtilitiesHelper(OpenEventTestCase):
13+
def setUp(self):
14+
self.app = Setup.create_app()
15+
16+
def test_modify_email_for_user_to_be_deleted(self):
17+
"""Method to test modification of email for user to be deleted"""
18+
19+
with app.test_request_context():
20+
user = create_user(email="[email protected]", password="testpass")
21+
save_to_db(user)
22+
modified_user = modify_email_for_user_to_be_deleted(user)
23+
self.assertEqual("[email protected]", modified_user.email)
24+
25+
def test_modify_email_for_user_to_be_restored(self):
26+
"""Method to test modification of email for user to be restored"""
27+
28+
with app.test_request_context():
29+
user = create_user(email="[email protected]", password="testpass")
30+
save_to_db(user)
31+
modified_user = modify_email_for_user_to_be_restored(user)
32+
self.assertEqual("[email protected]", modified_user.email)
33+
34+
35+
if __name__ == '__main__':
36+
unittest.main()

0 commit comments

Comments
 (0)