Commit ef91fcc029fb25c7abc6c4feec3285a7f7390d12
Committed by
Sergio Oliveira
1 parent
3a93344f
Exists in
master
and in
39 other branches
Applyied flake8 in test and view of signup.
Signed-off-by: Matheus Fernandes <matheus.souza.fernandes@gmail.com> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Showing
2 changed files
with
12 additions
and
10 deletions
Show diff stats
colab/accounts/tests/test_view_signup.py
| ... | ... | @@ -4,7 +4,8 @@ This test related with accounts/views.py |
| 4 | 4 | """ |
| 5 | 5 | |
| 6 | 6 | from django.test import TestCase, Client |
| 7 | -from colab.accounts.models import User | |
| 7 | +from colab.accounts.models import User | |
| 8 | + | |
| 8 | 9 | |
| 9 | 10 | class TestSignUpView(TestCase): |
| 10 | 11 | |
| ... | ... | @@ -17,7 +18,7 @@ class TestSignUpView(TestCase): |
| 17 | 18 | |
| 18 | 19 | def create_user_django(self): |
| 19 | 20 | user = User.objects.create_user("USERtestCoLaB", |
| 20 | - "usertest@colab.com.br", "123colab4") | |
| 21 | + "usertest@colab.com.br", "123colab4") | |
| 21 | 22 | return user |
| 22 | 23 | |
| 23 | 24 | def test_user_authenticated_and_unregistered(self): |
| ... | ... | @@ -38,7 +39,6 @@ class TestSignUpView(TestCase): |
| 38 | 39 | |
| 39 | 40 | def test_user_not_authenticated(self): |
| 40 | 41 | response = self.client.get("/account/register/") |
| 41 | - self.assertEquals(302 , response.status_code) | |
| 42 | + self.assertEquals(302, response.status_code) | |
| 42 | 43 | url = "http://testserver/account/login" |
| 43 | 44 | self.assertEquals(url, response.url) |
| 44 | - | ... | ... |
colab/accounts/views.py
| ... | ... | @@ -123,11 +123,11 @@ class UserProfileDetailView(UserProfileBaseMixin, DetailView): |
| 123 | 123 | |
| 124 | 124 | |
| 125 | 125 | def signup(request): |
| 126 | - # TODO: Refactor | |
| 127 | - user = request.user | |
| 126 | + # TODO: Refactor | |
| 128 | 127 | |
| 128 | + user = request.user | |
| 129 | 129 | # If the user is not authenticated in Persona, and try to access url |
| 130 | - # /account/register/ then he will be redirected to login page. | |
| 130 | + # /account/register/ then he will be redirected to login page. | |
| 131 | 131 | if not user.is_authenticated(): |
| 132 | 132 | return redirect('login') |
| 133 | 133 | |
| ... | ... | @@ -137,7 +137,7 @@ def signup(request): |
| 137 | 137 | if not user.needs_update: |
| 138 | 138 | return redirect('user_profile', username=user.username) |
| 139 | 139 | |
| 140 | - # If the user is authenticated in Persona, but not in the Colab then he | |
| 140 | + # If the user is authenticated in Persona, but not in the Colab then he | |
| 141 | 141 | # will be redirected to the register form. |
| 142 | 142 | if request.method == 'GET': |
| 143 | 143 | user_form = UserCreationForm() |
| ... | ... | @@ -159,7 +159,8 @@ def signup(request): |
| 159 | 159 | |
| 160 | 160 | # Check if the user's email have been used previously |
| 161 | 161 | # in the mainling lists to link the user to old messages |
| 162 | - email_addr, created = EmailAddress.objects.get_or_create(address=user.email) | |
| 162 | + email_addr, created = EmailAddress.objects.get_or_create( | |
| 163 | + address=user.email) | |
| 163 | 164 | if created: |
| 164 | 165 | email_addr.real_name = user.get_full_name() |
| 165 | 166 | |
| ... | ... | @@ -219,7 +220,8 @@ class ManageUserSubscriptionsView(UserProfileBaseMixin, DetailView): |
| 219 | 220 | |
| 220 | 221 | context.update(kwargs) |
| 221 | 222 | |
| 222 | - return super(ManageUserSubscriptionsView, self).get_context_data(**context) | |
| 223 | + return super(ManageUserSubscriptionsView, | |
| 224 | + self).get_context_data(**context) | |
| 223 | 225 | |
| 224 | 226 | |
| 225 | 227 | class ChangeXMPPPasswordView(UpdateView): | ... | ... |