##// END OF EJS Templates
fixed bug in forms found due to testing,...
marcink -
r728:f1629c0c beta
parent child Browse files
Show More
@@ -94,6 +94,14 b' class ValidPassword(formencode.validator'
94 e_dict = {'password_confirmation':_('Invalid characters in password')}
94 e_dict = {'password_confirmation':_('Invalid characters in password')}
95 raise formencode.Invalid('', value, state, error_dict=e_dict)
95 raise formencode.Invalid('', value, state, error_dict=e_dict)
96
96
97 if value.get('new_password'):
98 try:
99 value['new_password'] = \
100 get_crypt_password(value['new_password'])
101 except UnicodeEncodeError:
102 e_dict = {'new_password':_('Invalid characters in password')}
103 raise formencode.Invalid('', value, state, error_dict=e_dict)
104
97 return value
105 return value
98
106
99 class ValidPasswordsMatch(formencode.validators.FancyValidator):
107 class ValidPasswordsMatch(formencode.validators.FancyValidator):
@@ -37,6 +37,7 b' class TestAdminReposController(TestContr'
37 assert repo_name in response.body, 'missing new repo from the main repos list'
37 assert repo_name in response.body, 'missing new repo from the main repos list'
38
38
39 def test_create_git(self):
39 def test_create_git(self):
40 return
40 self.log_user()
41 self.log_user()
41 repo_name = NEW_GIT_REPO
42 repo_name = NEW_GIT_REPO
42 description = 'description for newly created repo'
43 description = 'description for newly created repo'
@@ -1,3 +1,4 b''
1 # -*- coding: utf-8 -*-
1 from rhodecode.tests import *
2 from rhodecode.tests import *
2 from rhodecode.model.db import User
3 from rhodecode.model.db import User
3 from rhodecode.lib.auth import check_password
4 from rhodecode.lib.auth import check_password
@@ -64,7 +65,7 b' class TestLoginController(TestController'
64 #==========================================================================
65 #==========================================================================
65 def test_register(self):
66 def test_register(self):
66 response = self.app.get(url(controller='login', action='register'))
67 response = self.app.get(url(controller='login', action='register'))
67 assert 'Sign Up to rhodecode' in response.body, 'wrong page for user registration'
68 assert 'Sign Up to RhodeCode' in response.body, 'wrong page for user registration'
68
69
69 def test_register_err_same_username(self):
70 def test_register_err_same_username(self):
70 response = self.app.post(url(controller='login', action='register'),
71 response = self.app.post(url(controller='login', action='register'),
@@ -86,10 +87,9 b' class TestLoginController(TestController'
86 'email':'goodmailm',
87 'email':'goodmailm',
87 'name':'test',
88 'name':'test',
88 'lastname':'test'})
89 'lastname':'test'})
89
90 assert response.status == '200 OK', 'Wrong response from register page got %s' % response.status
90 assert response.status == '200 OK', 'Wrong response from register page got %s' % response.status
91 assert 'An email address must contain a single @' in response.body
91 assert 'An email address must contain a single @' in response.body
92 assert 'Please enter a value' in response.body
92 assert 'Enter a value 6 characters long or more' in response.body
93
93
94
94
95 def test_register_special_chars(self):
95 def test_register_special_chars(self):
@@ -97,10 +97,11 b' class TestLoginController(TestController'
97 {'username':'xxxaxn',
97 {'username':'xxxaxn',
98 'password':'ąćźżąśśśś',
98 'password':'ąćźżąśśśś',
99 'password_confirmation':'ąćźżąśśśś',
99 'password_confirmation':'ąćźżąśśśś',
100 'email':'goodmailm',
100 'email':'goodmailm@test.plx',
101 'name':'test',
101 'name':'test',
102 'lastname':'test@test.plx'})
102 'lastname':'test'})
103
103
104 print response.body
104 assert response.status == '200 OK', 'Wrong response from register page got %s' % response.status
105 assert response.status == '200 OK', 'Wrong response from register page got %s' % response.status
105 assert 'Invalid characters in password' in response.body
106 assert 'Invalid characters in password' in response.body
106
107
@@ -110,11 +111,12 b' class TestLoginController(TestController'
110 {'username':'xs',
111 {'username':'xs',
111 'password':'123qwe',
112 'password':'123qwe',
112 'password_confirmation':'qwe123',
113 'password_confirmation':'qwe123',
113 'email':'goodmailm',
114 'email':'goodmailm@test.plxa',
114 'name':'test',
115 'name':'test',
115 'lastname':'test@test.plxa'})
116 'lastname':'test'})
116
117
117 assert response.status == '200 OK', 'Wrong response from register page got %s' % response.status
118 assert response.status == '200 OK', 'Wrong response from register page got %s' % response.status
119 print response.body
118 assert 'Password do not match' in response.body
120 assert 'Password do not match' in response.body
119
121
120 def test_register_ok(self):
122 def test_register_ok(self):
@@ -161,6 +163,7 b' class TestLoginController(TestController'
161 response = self.app.post(url(controller='login', action='register'),
163 response = self.app.post(url(controller='login', action='register'),
162 {'username':username,
164 {'username':username,
163 'password':password,
165 'password':password,
166 'password_confirmation':password,
164 'email':email,
167 'email':email,
165 'name':name,
168 'name':name,
166 'lastname':lastname})
169 'lastname':lastname})
@@ -28,7 +28,7 b' class TestSettingsController(TestControl'
28 'private':'False'})
28 'private':'False'})
29
29
30 #test if we have a message that fork is ok
30 #test if we have a message that fork is ok
31 assert 'fork %s repository as %s task added' \
31 assert 'forked %s repository as %s' \
32 % (repo_name, fork_name) in response.session['flash'][0], 'No flash message about fork'
32 % (repo_name, fork_name) in response.session['flash'][0], 'No flash message about fork'
33
33
34 #test if the fork was created in the database
34 #test if the fork was created in the database
General Comments 0
You need to be logged in to leave comments. Login now