Mercurial > kallithea
comparison rhodecode/tests/test_models.py @ 1818:cf51bbfb120e beta
auto white-space removal
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 29 Dec 2011 07:35:51 +0200 |
parents | a87aa385f21c |
children | 87f0800abc7b |
comparison
equal
deleted
inserted
replaced
1817:523b1011a625 | 1818:cf51bbfb120e |
---|---|
159 | 159 |
160 class TestUser(unittest.TestCase): | 160 class TestUser(unittest.TestCase): |
161 def __init__(self, methodName='runTest'): | 161 def __init__(self, methodName='runTest'): |
162 Session.remove() | 162 Session.remove() |
163 super(TestUser, self).__init__(methodName=methodName) | 163 super(TestUser, self).__init__(methodName=methodName) |
164 | 164 |
165 def test_create_and_remove(self): | 165 def test_create_and_remove(self): |
166 usr = UserModel().create_or_update(username=u'test_user', password=u'qweqwe', | 166 usr = UserModel().create_or_update(username=u'test_user', password=u'qweqwe', |
167 email=u'u232@rhodecode.org', | 167 email=u'u232@rhodecode.org', |
168 name=u'u1', lastname=u'u1') | 168 name=u'u1', lastname=u'u1') |
169 Session.commit() | 169 Session.commit() |
368 | 368 |
369 def setUp(self): | 369 def setUp(self): |
370 self.u1 = UserModel().create_or_update(username=u'u1', | 370 self.u1 = UserModel().create_or_update(username=u'u1', |
371 password=u'qweqwe', | 371 password=u'qweqwe', |
372 email=u'u1@rhodecode.org', | 372 email=u'u1@rhodecode.org', |
373 name=u'u1', lastname=u'u1') | 373 name=u'u1', lastname=u'u1') |
374 | 374 |
375 def tearDown(self): | 375 def tearDown(self): |
376 perm = Permission.query().all() | 376 perm = Permission.query().all() |
377 for p in perm: | 377 for p in perm: |
378 UserModel().revoke_perm(self.u1, p) | 378 UserModel().revoke_perm(self.u1, p) |
379 | 379 |
380 UserModel().delete(self.u1) | 380 UserModel().delete(self.u1) |
381 Session.commit() | 381 Session.commit() |
382 | 382 |
383 def test_add_perm(self): | 383 def test_add_perm(self): |
384 perm = Permission.query().all()[0] | 384 perm = Permission.query().all()[0] |
400 | 400 |
401 #revoke | 401 #revoke |
402 UserModel().revoke_perm(self.u1, perm) | 402 UserModel().revoke_perm(self.u1, perm) |
403 Session.commit() | 403 Session.commit() |
404 self.assertEqual(UserModel().has_perm(self.u1, perm),False) | 404 self.assertEqual(UserModel().has_perm(self.u1, perm),False) |
405 | |
406 | |
407 | |
408 | |
409 | |
410 |