##// END OF EJS Templates
more test suites on login, fixed strange detached instance bug found during in tests....
marcink -
r462:29854618 default
parent child Browse files
Show More
@@ -0,0 +1,8 b''
1 from pylons_app.tests import *
2
3 class TestAdminController(TestController):
4
5 def test_index(self):
6
7 response = self.app.get(url(controller='hg', action='index'))
8 # Test response... No newline at end of file
@@ -1,3 +1,5 b''
1 include COPYING
2 include README.rst
1 include pylons_app/config/deployment.ini_tmpl
3 include pylons_app/config/deployment.ini_tmpl
2
4
3 include hg_app_daemon
5 include hg_app_daemon
@@ -22,6 +22,7 b' def format_sql(sql):'
22 sql = sql.replace('\n', '')
22 sql = sql.replace('\n', '')
23 sql = one_space_trim(sql)
23 sql = one_space_trim(sql)
24 sql = sql\
24 sql = sql\
25 .replace(',',',\n\t')\
25 .replace('SELECT', '\n\tSELECT \n\t')\
26 .replace('SELECT', '\n\tSELECT \n\t')\
26 .replace('UPDATE', '\n\tUPDATE \n\t')\
27 .replace('UPDATE', '\n\tUPDATE \n\t')\
27 .replace('DELETE', '\n\tDELETE \n\t')\
28 .replace('DELETE', '\n\tDELETE \n\t')\
@@ -56,7 +56,7 b' class User(Base):'
56 self.last_login = datetime.datetime.now()
56 self.last_login = datetime.datetime.now()
57 session.add(self)
57 session.add(self)
58 session.commit()
58 session.commit()
59 log.debug('updated user %s lastlogin',self)
59 log.debug('updated user %s lastlogin',self.username)
60 except Exception:
60 except Exception:
61 session.rollback()
61 session.rollback()
62
62
@@ -12,13 +12,19 b' class TestLoginController(TestController'
12 {'username':'test_admin',
12 {'username':'test_admin',
13 'password':'test'})
13 'password':'test'})
14 assert response.status == '302 Found','Wrong response code from login'
14 assert response.status == '302 Found','Wrong response code from login'
15 assert response.session['hg_app_user'].username =='test_admin','wrong logged in user'
16 response = response.follow()
17 assert 'auto description for vcs_test' in response.body
15
18
16 def test_login_regular_ok(self):
19 def test_login_regular_ok(self):
17 response = self.app.post(url(controller='login', action='index'),
20 response = self.app.post(url(controller='login', action='index'),
18 {'username':'test_admin',
21 {'username':'test_regular',
19 'password':'test'})
22 'password':'test'})
20 assert response.status == '302 Found','Wrong response code from login'
23 assert response.status == '302 Found','Wrong response code from login'
21
24 assert response.session['hg_app_user'].username =='test_regular','wrong logged in user'
25 response = response.follow()
26 assert 'auto description for vcs_test' in response.body
27 assert '<a title="Admin" href="/_admin">' not in response.body
22
28
23 def test_login_ok_came_from(self):
29 def test_login_ok_came_from(self):
24 test_came_from = '/_admin/users'
30 test_came_from = '/_admin/users'
General Comments 0
You need to be logged in to leave comments. Login now