Commit 0c61dbf4a55f3a2cb1b23f7719b0f28e4948fe18
Committed by
Matheus de Sousa Faria
1 parent
a7d56eaf
Exists in
master
and in
4 other branches
Testing signup method from accounts
Signed-off-by: Tomaz Martins <tomaz.r.martins@gmail.com> Signed-off-by: Gustavo Jaruga <darksshades@gmail.com> Signed-off-by: Luiz Oliveira <ziuloliveira@gmail.com>
Showing
1 changed file
with
30 additions
and
0 deletions
Show diff stats
colab/accounts/tests/test_user.py
... | ... | @@ -7,6 +7,7 @@ import mock |
7 | 7 | from colab.accounts.models import User |
8 | 8 | from colab.accounts import forms as accounts_forms |
9 | 9 | from django.test import TestCase, Client |
10 | +from colab.accounts.views import UserProfileUpdateView | |
10 | 11 | |
11 | 12 | |
12 | 13 | class UserTest(TestCase): |
... | ... | @@ -374,3 +375,32 @@ class UserTest(TestCase): |
374 | 375 | self.authenticate_user() |
375 | 376 | self.validate_non_mandatory_fields('bio', '', ' ') |
376 | 377 | self.user.delete() |
378 | + | |
379 | + def test_user_without_login(self): | |
380 | + response = self.client.get("/account/" + self.user.username + "/edit") | |
381 | + self.assertEqual(response.status_code, 403) | |
382 | + | |
383 | + def test_signup_with_post_not_success(self): | |
384 | + data_user = { | |
385 | + 'username': 'username', | |
386 | + 'password1': 'safepassword', | |
387 | + 'password2': 'safepassword', | |
388 | + } | |
389 | + before = User.objects.count() | |
390 | + responses = self.client.post('/account/register', data=data_user) | |
391 | + after = User.objects.count() | |
392 | + self.assertEqual(before, after) | |
393 | + | |
394 | + def test_signup_with_post_with_success(self): | |
395 | + data_user = { | |
396 | + 'username': 'username', | |
397 | + 'first_name': 'first name', | |
398 | + 'last_name': 'last name', | |
399 | + 'email':'mail@mail.com', | |
400 | + 'password1': 'safepassword', | |
401 | + 'password2': 'safepassword', | |
402 | + } | |
403 | + before = User.objects.count() | |
404 | + responses = self.client.post('/account/register', data=data_user) | |
405 | + after = User.objects.count() | |
406 | + self.assertEqual(before + 1, after) | ... | ... |