Commit 1aafcce7ae5e054ff71dde4f7a36dc86086a7c3e
1 parent
c4dd802c
Exists in
master
and in
3 other branches
Fixing flake8
Signed-off-by: Alexandre Barbosa <alexandreab@live.com> Signed-off-by: Lucas Moura <lucas.moura128@gmail.com>
Showing
1 changed file
with
5 additions
and
7 deletions
Show diff stats
colab/accounts/tests/test_forms.py
| ... | ... | @@ -8,7 +8,6 @@ from mock import patch |
| 8 | 8 | |
| 9 | 9 | from django.test import TestCase, override_settings |
| 10 | 10 | from django.core.urlresolvers import reverse |
| 11 | -from django.forms import ValidationError | |
| 12 | 11 | |
| 13 | 12 | from colab.accounts.forms import (UserCreationForm, UserChangeForm, |
| 14 | 13 | UserUpdateForm, UserForm, get_lists_choices, |
| ... | ... | @@ -282,7 +281,7 @@ class UserCreationFormTestCase(TestCase): |
| 282 | 281 | creation_form = UserCreationForm( |
| 283 | 282 | data=self.get_form_data('teste1234@example.com')) |
| 284 | 283 | self.assertFalse(creation_form.is_valid()) |
| 285 | - self.assertTrue(creation_form.errors.has_key('email')) | |
| 284 | + self.assertTrue('email' in creation_form.errors) | |
| 286 | 285 | self.assertEqual(1, len(creation_form.errors)) |
| 287 | 286 | |
| 288 | 287 | def test_clean_mail(self): |
| ... | ... | @@ -295,7 +294,7 @@ class UserCreationFormTestCase(TestCase): |
| 295 | 294 | data=self.get_form_data('teste12345@example.com', |
| 296 | 295 | username='user1234')) |
| 297 | 296 | self.assertFalse(creation_form.is_valid()) |
| 298 | - self.assertTrue(creation_form.errors.has_key('username')) | |
| 297 | + self.assertTrue('username' in creation_form.errors) | |
| 299 | 298 | self.assertEqual(1, len(creation_form.errors)) |
| 300 | 299 | |
| 301 | 300 | def test_clean_username(self): |
| ... | ... | @@ -304,14 +303,13 @@ class UserCreationFormTestCase(TestCase): |
| 304 | 303 | username='user12345')) |
| 305 | 304 | self.assertTrue(creation_form.is_valid()) |
| 306 | 305 | |
| 307 | - | |
| 308 | 306 | def test_clean_password2_empty_password1(self): |
| 309 | 307 | creation_form = UserCreationForm( |
| 310 | 308 | data=self.get_form_data('teste12345@example.com', |
| 311 | 309 | username='user12345', |
| 312 | 310 | password1='')) |
| 313 | 311 | self.assertFalse(creation_form.is_valid()) |
| 314 | - self.assertTrue(creation_form.errors.has_key('password1')) | |
| 312 | + self.assertTrue('password1' in creation_form.errors) | |
| 315 | 313 | self.assertEqual(1, len(creation_form.errors)) |
| 316 | 314 | |
| 317 | 315 | def test_clean_password2_empty_password2(self): |
| ... | ... | @@ -320,7 +318,7 @@ class UserCreationFormTestCase(TestCase): |
| 320 | 318 | username='user12345', |
| 321 | 319 | password2='')) |
| 322 | 320 | self.assertFalse(creation_form.is_valid()) |
| 323 | - self.assertTrue(creation_form.errors.has_key('password2')) | |
| 321 | + self.assertTrue('password2' in creation_form.errors) | |
| 324 | 322 | |
| 325 | 323 | def test_clean_password2_different_passwords(self): |
| 326 | 324 | creation_form = UserCreationForm( |
| ... | ... | @@ -328,7 +326,7 @@ class UserCreationFormTestCase(TestCase): |
| 328 | 326 | username='user12345', |
| 329 | 327 | password1='1234')) |
| 330 | 328 | self.assertFalse(creation_form.is_valid()) |
| 331 | - self.assertTrue(creation_form.errors.has_key('password2')) | |
| 329 | + self.assertTrue('password2' in creation_form.errors) | |
| 332 | 330 | self.assertEqual(1, len(creation_form.errors)) |
| 333 | 331 | self.assertEqual(1, len(creation_form.errors)) |
| 334 | 332 | ... | ... |