##// END OF EJS Templates
fixed login tests
marcink -
r3630:5d8cda8e beta
parent child Browse files
Show More
@@ -29,7 +29,7 b' class TestLoginController(TestController'
29 self.assertEqual(response.session['rhodecode_user'].get('username'),
29 self.assertEqual(response.session['rhodecode_user'].get('username'),
30 'test_admin')
30 'test_admin')
31 response = response.follow()
31 response = response.follow()
32 self.assertTrue('%s repository' % HG_REPO in response.body)
32 response.mustcontain('/%s' % HG_REPO)
33
33
34 def test_login_regular_ok(self):
34 def test_login_regular_ok(self):
35 response = self.app.post(url(controller='login', action='index'),
35 response = self.app.post(url(controller='login', action='index'),
@@ -40,8 +40,7 b' class TestLoginController(TestController'
40 self.assertEqual(response.session['rhodecode_user'].get('username'),
40 self.assertEqual(response.session['rhodecode_user'].get('username'),
41 'test_regular')
41 'test_regular')
42 response = response.follow()
42 response = response.follow()
43 self.assertTrue('%s repository' % HG_REPO in response.body)
43 response.mustcontain('/%s' % HG_REPO)
44 self.assertTrue('<a title="Admin" href="/_admin">' not in response.body)
45
44
46 def test_login_ok_came_from(self):
45 def test_login_ok_came_from(self):
47 test_came_from = '/_admin/users'
46 test_came_from = '/_admin/users'
@@ -53,7 +52,7 b' class TestLoginController(TestController'
53 response = response.follow()
52 response = response.follow()
54
53
55 self.assertEqual(response.status, '200 OK')
54 self.assertEqual(response.status, '200 OK')
56 self.assertTrue('Users administration' in response.body)
55 response.mustcontain('Users administration')
57
56
58 @parameterized.expand([
57 @parameterized.expand([
59 ('data:text/html,<script>window.alert("xss")</script>',),
58 ('data:text/html,<script>window.alert("xss")</script>',),
@@ -80,22 +79,22 b' class TestLoginController(TestController'
80 'password': 'as'})
79 'password': 'as'})
81 self.assertEqual(response.status, '200 OK')
80 self.assertEqual(response.status, '200 OK')
82
81
83 self.assertTrue('Enter 3 characters or more' in response.body)
82 response.mustcontain('Enter 3 characters or more')
84
83
85 def test_login_wrong_username_password(self):
84 def test_login_wrong_username_password(self):
86 response = self.app.post(url(controller='login', action='index'),
85 response = self.app.post(url(controller='login', action='index'),
87 {'username': 'error',
86 {'username': 'error',
88 'password': 'test12'})
87 'password': 'test12'})
89
88
90 self.assertTrue('invalid user name' in response.body)
89 response.mustcontain('invalid user name')
91 self.assertTrue('invalid password' in response.body)
90 response.mustcontain('invalid password')
92
91
93 #==========================================================================
92 #==========================================================================
94 # REGISTRATIONS
93 # REGISTRATIONS
95 #==========================================================================
94 #==========================================================================
96 def test_register(self):
95 def test_register(self):
97 response = self.app.get(url(controller='login', action='register'))
96 response = self.app.get(url(controller='login', action='register'))
98 self.assertTrue('Sign Up to RhodeCode' in response.body)
97 response.mustcontain('Sign Up to RhodeCode')
99
98
100 def test_register_err_same_username(self):
99 def test_register_err_same_username(self):
101 uname = 'test_admin'
100 uname = 'test_admin'
General Comments 0
You need to be logged in to leave comments. Login now