comparison rhodecode/tests/models/test_users.py @ 3647:8a86836fad64 beta

more usage of fixture tools in tests
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 01 Apr 2013 23:45:25 +0200
parents fa6ba6727475
children 7e3d89d9d3a2
comparison
equal deleted inserted replaced
3646:63e49418a4cc 3647:8a86836fad64
11 11
12 class TestUser(unittest.TestCase): 12 class TestUser(unittest.TestCase):
13 def __init__(self, methodName='runTest'): 13 def __init__(self, methodName='runTest'):
14 Session.remove() 14 Session.remove()
15 super(TestUser, self).__init__(methodName=methodName) 15 super(TestUser, self).__init__(methodName=methodName)
16
17 def tearDown(self):
18 Session.remove()
16 19
17 def test_create_and_remove(self): 20 def test_create_and_remove(self):
18 usr = UserModel().create_or_update(username=u'test_user', 21 usr = UserModel().create_or_update(username=u'test_user',
19 password=u'qweqwe', 22 password=u'qweqwe',
20 email=u'u232@rhodecode.org', 23 email=u'u232@rhodecode.org',
97 for p in perm: 100 for p in perm:
98 UserModel().revoke_perm(self.u1, p) 101 UserModel().revoke_perm(self.u1, p)
99 102
100 UserModel().delete(self.u1) 103 UserModel().delete(self.u1)
101 Session().commit() 104 Session().commit()
105 Session.remove()
102 106
103 def test_add_perm(self): 107 def test_add_perm(self):
104 perm = Permission.query().all()[0] 108 perm = Permission.query().all()[0]
105 UserModel().grant_perm(self.u1, perm) 109 UserModel().grant_perm(self.u1, perm)
106 Session().commit() 110 Session().commit()