Mercurial > kallithea
comparison rhodecode/tests/functional/test_login.py @ 2595:6c83dc0226d2 beta
renamed some leftover name -> firstname
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 12 Jul 2012 17:14:59 +0200 |
parents | 40b3a54391f9 |
children | dffb92224edf |
comparison
equal
deleted
inserted
replaced
2594:3a54e1e121d5 | 2595:6c83dc0226d2 |
---|---|
83 response = self.app.post(url(controller='login', action='register'), | 83 response = self.app.post(url(controller='login', action='register'), |
84 {'username': uname, | 84 {'username': uname, |
85 'password': 'test12', | 85 'password': 'test12', |
86 'password_confirmation': 'test12', | 86 'password_confirmation': 'test12', |
87 'email': 'goodmail@domain.com', | 87 'email': 'goodmail@domain.com', |
88 'name': 'test', | 88 'firstname': 'test', |
89 'lastname': 'test'}) | 89 'lastname': 'test'}) |
90 | 90 |
91 msg = validators.ValidUsername()._messages['username_exists'] | 91 msg = validators.ValidUsername()._messages['username_exists'] |
92 msg = h.html_escape(msg % {'username': uname}) | 92 msg = h.html_escape(msg % {'username': uname}) |
93 response.mustcontain(msg) | 93 response.mustcontain(msg) |
96 response = self.app.post(url(controller='login', action='register'), | 96 response = self.app.post(url(controller='login', action='register'), |
97 {'username': 'test_admin_0', | 97 {'username': 'test_admin_0', |
98 'password': 'test12', | 98 'password': 'test12', |
99 'password_confirmation': 'test12', | 99 'password_confirmation': 'test12', |
100 'email': 'test_admin@mail.com', | 100 'email': 'test_admin@mail.com', |
101 'name': 'test', | 101 'firstname': 'test', |
102 'lastname': 'test'}) | 102 'lastname': 'test'}) |
103 | 103 |
104 msg = validators.UniqSystemEmail()()._messages['email_taken'] | 104 msg = validators.UniqSystemEmail()()._messages['email_taken'] |
105 response.mustcontain(msg) | 105 response.mustcontain(msg) |
106 | 106 |
108 response = self.app.post(url(controller='login', action='register'), | 108 response = self.app.post(url(controller='login', action='register'), |
109 {'username': 'test_admin_1', | 109 {'username': 'test_admin_1', |
110 'password': 'test12', | 110 'password': 'test12', |
111 'password_confirmation': 'test12', | 111 'password_confirmation': 'test12', |
112 'email': 'TesT_Admin@mail.COM', | 112 'email': 'TesT_Admin@mail.COM', |
113 'name': 'test', | 113 'firstname': 'test', |
114 'lastname': 'test'}) | 114 'lastname': 'test'}) |
115 msg = validators.UniqSystemEmail()()._messages['email_taken'] | 115 msg = validators.UniqSystemEmail()()._messages['email_taken'] |
116 response.mustcontain(msg) | 116 response.mustcontain(msg) |
117 | 117 |
118 def test_register_err_wrong_data(self): | 118 def test_register_err_wrong_data(self): |
119 response = self.app.post(url(controller='login', action='register'), | 119 response = self.app.post(url(controller='login', action='register'), |
120 {'username': 'xs', | 120 {'username': 'xs', |
121 'password': 'test', | 121 'password': 'test', |
122 'password_confirmation': 'test', | 122 'password_confirmation': 'test', |
123 'email': 'goodmailm', | 123 'email': 'goodmailm', |
124 'name': 'test', | 124 'firstname': 'test', |
125 'lastname': 'test'}) | 125 'lastname': 'test'}) |
126 self.assertEqual(response.status, '200 OK') | 126 self.assertEqual(response.status, '200 OK') |
127 response.mustcontain('An email address must contain a single @') | 127 response.mustcontain('An email address must contain a single @') |
128 response.mustcontain('Enter a value 6 characters long or more') | 128 response.mustcontain('Enter a value 6 characters long or more') |
129 | 129 |
131 response = self.app.post(url(controller='login', action='register'), | 131 response = self.app.post(url(controller='login', action='register'), |
132 {'username': 'error user', | 132 {'username': 'error user', |
133 'password': 'test12', | 133 'password': 'test12', |
134 'password_confirmation': 'test12', | 134 'password_confirmation': 'test12', |
135 'email': 'goodmailm', | 135 'email': 'goodmailm', |
136 'name': 'test', | 136 'firstname': 'test', |
137 'lastname': 'test'}) | 137 'lastname': 'test'}) |
138 | 138 |
139 response.mustcontain('An email address must contain a single @') | 139 response.mustcontain('An email address must contain a single @') |
140 response.mustcontain('Username may only contain ' | 140 response.mustcontain('Username may only contain ' |
141 'alphanumeric characters underscores, ' | 141 'alphanumeric characters underscores, ' |
147 response = self.app.post(url(controller='login', action='register'), | 147 response = self.app.post(url(controller='login', action='register'), |
148 {'username': usr, | 148 {'username': usr, |
149 'password': 'test12', | 149 'password': 'test12', |
150 'password_confirmation': 'test12', | 150 'password_confirmation': 'test12', |
151 'email': 'goodmailm', | 151 'email': 'goodmailm', |
152 'name': 'test', | 152 'firstname': 'test', |
153 'lastname': 'test'}) | 153 'lastname': 'test'}) |
154 | 154 |
155 response.mustcontain('An email address must contain a single @') | 155 response.mustcontain('An email address must contain a single @') |
156 msg = validators.ValidUsername()._messages['username_exists'] | 156 msg = validators.ValidUsername()._messages['username_exists'] |
157 msg = h.html_escape(msg % {'username': usr}) | 157 msg = h.html_escape(msg % {'username': usr}) |
161 response = self.app.post(url(controller='login', action='register'), | 161 response = self.app.post(url(controller='login', action='register'), |
162 {'username': 'xxxaxn', | 162 {'username': 'xxxaxn', |
163 'password': 'ąćźżąśśśś', | 163 'password': 'ąćźżąśśśś', |
164 'password_confirmation': 'ąćźżąśśśś', | 164 'password_confirmation': 'ąćźżąśśśś', |
165 'email': 'goodmailm@test.plx', | 165 'email': 'goodmailm@test.plx', |
166 'name': 'test', | 166 'firstname': 'test', |
167 'lastname': 'test'}) | 167 'lastname': 'test'}) |
168 | 168 |
169 msg = validators.ValidPassword()._messages['invalid_password'] | 169 msg = validators.ValidPassword()._messages['invalid_password'] |
170 response.mustcontain(msg) | 170 response.mustcontain(msg) |
171 | 171 |
173 response = self.app.post(url(controller='login', action='register'), | 173 response = self.app.post(url(controller='login', action='register'), |
174 {'username': 'xs', | 174 {'username': 'xs', |
175 'password': '123qwe', | 175 'password': '123qwe', |
176 'password_confirmation': 'qwe123', | 176 'password_confirmation': 'qwe123', |
177 'email': 'goodmailm@test.plxa', | 177 'email': 'goodmailm@test.plxa', |
178 'name': 'test', | 178 'firstname': 'test', |
179 'lastname': 'test'}) | 179 'lastname': 'test'}) |
180 msg = validators.ValidPasswordsMatch()._messages['password_mismatch'] | 180 msg = validators.ValidPasswordsMatch()._messages['password_mismatch'] |
181 response.mustcontain(msg) | 181 response.mustcontain(msg) |
182 | 182 |
183 def test_register_ok(self): | 183 def test_register_ok(self): |
190 response = self.app.post(url(controller='login', action='register'), | 190 response = self.app.post(url(controller='login', action='register'), |
191 {'username': username, | 191 {'username': username, |
192 'password': password, | 192 'password': password, |
193 'password_confirmation': password, | 193 'password_confirmation': password, |
194 'email': email, | 194 'email': email, |
195 'name': name, | 195 'firstname': name, |
196 'lastname': lastname, | 196 'lastname': lastname, |
197 'admin': True}) # This should be overriden | 197 'admin': True}) # This should be overriden |
198 self.assertEqual(response.status, '302 Found') | 198 self.assertEqual(response.status, '302 Found') |
199 self.checkSessionFlash(response, 'You have successfully registered into rhodecode') | 199 self.checkSessionFlash(response, 'You have successfully registered into rhodecode') |
200 | 200 |