Commit 64e8f5873f728891d43d130f41396d27f34148fd
1 parent
5f579329
Exists in
master
and in
5 other branches
Test register_user_ok ##5
Showing
2 changed files
with
8 additions
and
8 deletions
Show diff stats
core/forms.py
... | ... | @@ -6,7 +6,7 @@ class RegisterUserForm(forms.ModelForm): |
6 | 6 | |
7 | 7 | password = forms.CharField(label='Senha', widget=forms.PasswordInput) |
8 | 8 | password2 = forms.CharField(label = 'Confirmacao de Senha', widget = forms.PasswordInput) |
9 | - birth_date = forms.DateField(widget=forms.SelectDateWidget()) | |
9 | + # birth_date = forms.DateField(widget=forms.SelectDateWidget()) | |
10 | 10 | MIN_LENGTH = 8 |
11 | 11 | |
12 | 12 | def clean_password(self): |
... | ... | @@ -42,4 +42,4 @@ class RegisterUserForm(forms.ModelForm): |
42 | 42 | class Meta: |
43 | 43 | model = User |
44 | 44 | # exclude = ['is_staff', 'is_active'] |
45 | - fields = ['username', 'name', 'email', 'city', 'state', 'gender', 'cpf', 'phone', 'image'] | |
46 | 45 | \ No newline at end of file |
46 | + fields = ['username', 'name', 'email', 'city', 'state', 'gender', 'cpf', 'birth_date', 'phone', 'image'] | |
47 | 47 | \ No newline at end of file | ... | ... |
core/tests.py
... | ... | @@ -42,11 +42,7 @@ class RegisterUserTestCase(TestCase): |
42 | 42 | def setUp(self): |
43 | 43 | self.client = Client() |
44 | 44 | self.url = reverse('core:register') |
45 | - | |
46 | - def test_register_ok(self): | |
47 | - | |
48 | - response = self.client.post(self.url, | |
49 | - data={ | |
45 | + self.data = { | |
50 | 46 | 'username': 'testeamadeus', |
51 | 47 | 'email': 'teste@amadeus.com', |
52 | 48 | 'password': 'aminhasenha1', |
... | ... | @@ -55,7 +51,11 @@ class RegisterUserTestCase(TestCase): |
55 | 51 | 'city': 'Praia', |
56 | 52 | 'state': 'PE', |
57 | 53 | 'gender': 'F', |
58 | - }) | |
54 | + } | |
55 | + | |
56 | + def test_register_ok(self): | |
57 | + | |
58 | + response = self.client.post(self.url, self.data) | |
59 | 59 | self.assertRedirects(response, 'http://localhost%s' % reverse('core:home')) |
60 | 60 | self.assertEqual(response.status_code, 302) |
61 | 61 | self.assertEqual(User.objects.count(), 1) | ... | ... |