diff rhodecode/tests/functional/test_login.py @ 2529:40b3a54391f9 beta

Added functional test create repo with a group - unified calling Session in tests
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 01 Jul 2012 18:06:34 +0200
parents 4419551b2915
children 6c83dc0226d2
line wrap: on
line diff
--- a/rhodecode/tests/functional/test_login.py	Sun Jul 01 17:49:42 2012 +0200
+++ b/rhodecode/tests/functional/test_login.py	Sun Jul 01 18:06:34 2012 +0200
@@ -3,7 +3,6 @@
 from rhodecode.model.db import User, Notification
 from rhodecode.lib.utils2 import generate_api_key
 from rhodecode.lib.auth import check_password
-from rhodecode.model.meta import Session
 from rhodecode.lib import helpers as h
 from rhodecode.model import validators
 
@@ -12,9 +11,9 @@
 
     def tearDown(self):
         for n in Notification.query().all():
-            Session.delete(n)
+            self.Session().delete(n)
 
-        Session.commit()
+        self.Session().commit()
         self.assertEqual(Notification.query().all(), [])
 
     def test_index(self):
@@ -199,7 +198,7 @@
         self.assertEqual(response.status, '302 Found')
         self.checkSessionFlash(response, 'You have successfully registered into rhodecode')
 
-        ret = self.Session.query(User).filter(User.username == 'test_regular4').one()
+        ret = self.Session().query(User).filter(User.username == 'test_regular4').one()
         self.assertEqual(ret.username, username)
         self.assertEqual(check_password(password, ret.password), True)
         self.assertEqual(ret.email, email)
@@ -237,8 +236,8 @@
         new.name = name
         new.lastname = lastname
         new.api_key = generate_api_key(username)
-        self.Session.add(new)
-        self.Session.commit()
+        self.Session().add(new)
+        self.Session().commit()
 
         response = self.app.post(url(controller='login',
                                      action='password_reset'),