Commit a7d56eaf8a08ef0c828639c39ec8b7dbb95e5445
Committed by
Matheus de Sousa Faria
1 parent
0b8f3f6a
Exists in
master
and in
4 other branches
Tests for social network enabled
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
2 changed files
with
26 additions
and
1 deletions
Show diff stats
colab/accounts/tests/test_request.py
| ... | ... | @@ -6,6 +6,8 @@ Objective: Test requests. |
| 6 | 6 | from django.test import TestCase, Client |
| 7 | 7 | from django.test.client import RequestFactory |
| 8 | 8 | from colab.accounts.models import User |
| 9 | +from colab.accounts.context_processors import social_network_enabled | |
| 10 | +from django.conf import settings | |
| 9 | 11 | |
| 10 | 12 | |
| 11 | 13 | class RequestTest(TestCase): |
| ... | ... | @@ -65,3 +67,26 @@ class RequestTest(TestCase): |
| 65 | 67 | self.assertEqual(302, response.status_code) |
| 66 | 68 | self.assertEqual("http://testserver/account/usertest/subscriptions", |
| 67 | 69 | response.url) |
| 70 | + | |
| 71 | + | |
| 72 | +class SocialNetworkTest(TestCase): | |
| 73 | + """docstring for SocialNetworkTest""" | |
| 74 | + | |
| 75 | + def setUp(self): | |
| 76 | + self.factory = RequestFactory() | |
| 77 | + self.client = Client() | |
| 78 | + | |
| 79 | + def create_user(self): | |
| 80 | + self.user_test = User() | |
| 81 | + self.user_test.username = "usertest" | |
| 82 | + self.user_test.email = "usertest@colab.com.br" | |
| 83 | + self.user_test.set_password("1234colab") | |
| 84 | + self.user_test.save() | |
| 85 | + | |
| 86 | + def test_social_network(self): | |
| 87 | + self.create_user() | |
| 88 | + self.client.login(username="usertest", password='1234colab') | |
| 89 | + response = self.client.get('/myaccount/') | |
| 90 | + result = social_network_enabled(response)['SOCIAL_NETWORK_ENABLED'] | |
| 91 | + self.assertTrue(result) | |
| 92 | + self.assertTrue(settings.SOCIAL_NETWORK_ENABLED) | ... | ... |
colab/settings.py