Add user manipulation test
This commit is contained in:
parent
7f1ba28184
commit
1a4ccfec01
|
@ -175,6 +175,30 @@ class TestDBFactory(TestCase):
|
||||||
TestDBFactory
|
TestDBFactory
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@unittest.skipIf(control.skip_test, control.skip_reason)
|
||||||
|
def test_create_user(self):
|
||||||
|
new_user_name = 'user_creation_test'
|
||||||
|
new_user_id = control.database.create_user(new_user_name, control.application_id, 'test', UserRoles.Admin)
|
||||||
|
|
||||||
|
saved_user = control.database.get_by_name_and_application(new_user_name, control.application_id)
|
||||||
|
self.assertEqual(new_user_id, saved_user.id, "Could not find matching user id")
|
||||||
|
|
||||||
|
control.database.delete_user(new_user_id)
|
||||||
|
|
||||||
|
@unittest.skipIf(control.skip_test, control.skip_reason)
|
||||||
|
def test_create_and_delete_user(self):
|
||||||
|
new_user_name = 'user_deletion_test'
|
||||||
|
new_user_id = control.database.create_user(new_user_name, control.application_id, 'test', UserRoles.Admin)
|
||||||
|
|
||||||
|
control.database.get_by_name_and_application(new_user_name, control.application_id)
|
||||||
|
|
||||||
|
control.database.delete_user(new_user_id)
|
||||||
|
try:
|
||||||
|
deleted_user = control.database.get_by_name_and_application(new_user_name, control.application_id)
|
||||||
|
self.assertIsNone(deleted_user, "User was not deleted successfully")
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
|
|
||||||
@unittest.skipIf(control.skip_test, control.skip_reason)
|
@unittest.skipIf(control.skip_test, control.skip_reason)
|
||||||
def test_create_city(self):
|
def test_create_city(self):
|
||||||
control.city.name = "Montreal"
|
control.city.name = "Montreal"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user