Commit d6414cc43413d7d7d964705155d34672300c742f
Committed by
Sergio Oliveira
1 parent
66b2ece5
Exists in
master
and in
39 other branches
Add case when BROWSERID_ENABLED is true.
Signed-off-by: Sergio Oliveira <sergio@tracy.com.br> Signed-off-by: Thiago Ribeiro <thiagitosouza@gmail.com>
Showing
1 changed file
with
8 additions
and
9 deletions
Show diff stats
colab/accounts/tests/test_view_signup.py
| @@ -5,7 +5,7 @@ This test related with accounts/views.py | @@ -5,7 +5,7 @@ This test related with accounts/views.py | ||
| 5 | 5 | ||
| 6 | from django.test import TestCase, Client | 6 | from django.test import TestCase, Client |
| 7 | from colab.accounts.models import User | 7 | from colab.accounts.models import User |
| 8 | -from django.core.cache import cache | 8 | + |
| 9 | 9 | ||
| 10 | class TestSignUpView(TestCase): | 10 | class TestSignUpView(TestCase): |
| 11 | 11 | ||
| @@ -21,6 +21,13 @@ class TestSignUpView(TestCase): | @@ -21,6 +21,13 @@ class TestSignUpView(TestCase): | ||
| 21 | "usertest@colab.com.br", "123colab4") | 21 | "usertest@colab.com.br", "123colab4") |
| 22 | return user | 22 | return user |
| 23 | 23 | ||
| 24 | + def test_user_not_authenticated(self): | ||
| 25 | + with self.settings(BROWSERID_ENABLED=True): | ||
| 26 | + response = self.client.get("/account/register") | ||
| 27 | + self.assertEquals(302, response.status_code) | ||
| 28 | + url = "http://testserver/account/login" | ||
| 29 | + self.assertEquals(url, response.url) | ||
| 30 | + | ||
| 24 | def test_user_authenticated_and_unregistered(self): | 31 | def test_user_authenticated_and_unregistered(self): |
| 25 | self.client.login(username="usertestcolab", password="123colab4") | 32 | self.client.login(username="usertestcolab", password="123colab4") |
| 26 | response = self.client.get("/account/register/") | 33 | response = self.client.get("/account/register/") |
| @@ -36,11 +43,3 @@ class TestSignUpView(TestCase): | @@ -36,11 +43,3 @@ class TestSignUpView(TestCase): | ||
| 36 | url = "http://testserver/account/usertestcolab" | 43 | url = "http://testserver/account/usertestcolab" |
| 37 | self.assertEquals(url, response.url) | 44 | self.assertEquals(url, response.url) |
| 38 | self.client.logout() | 45 | self.client.logout() |
| 39 | - | ||
| 40 | - def test_user_not_authenticated(self): | ||
| 41 | - with self.settings(BROWSERID_ENABLE=True): | ||
| 42 | - cache.clear() | ||
| 43 | - response = self.client.get("/account/register/") | ||
| 44 | - self.assertEquals(302, response.status_code) | ||
| 45 | - url = "http://testserver/account/login" | ||
| 46 | - self.assertEquals(url, response.url) |