Skip to content

Commit

Permalink
Formatting fixes + python 3.5 mock fix
Browse files Browse the repository at this point in the history
  • Loading branch information
apragacz committed Mar 26, 2019
1 parent 4dd4171 commit 1516ac9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions rest_registration/settings_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ def __new__(cls, name, *, default=None, help=None, import_string=False):
'REGISTER_VERIFICATION_AUTO_LOGIN',
default=False,
help=dedent("""\
Specifies whether a user will be logged in automatically when they
verify their registration.
"""),
Specifies whether a user will be logged in automatically when they
verify their registration.
"""),
),
]

Expand Down
9 changes: 6 additions & 3 deletions tests/api/test_register.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import math
import time
from unittest import mock
from unittest.mock import patch

from django.test.utils import override_settings
Expand Down Expand Up @@ -289,11 +290,13 @@ def test_verify_ok(self):
user.refresh_from_db()
self.assertTrue(user.is_active)

@override_settings(REST_REGISTRATION=REST_REGISTRATION_WITH_VERIFICATION_AUTO_LOGIN)
@override_settings(
REST_REGISTRATION=REST_REGISTRATION_WITH_VERIFICATION_AUTO_LOGIN,
)
def test_verify_ok_login(self):
with patch('django.contrib.auth.login') as mock:
with patch('django.contrib.auth.login') as login_mock:
user, response = self.create_verify_and_user()
mock.assert_called()
login_mock.assert_called_once_with(mock.ANY, user)
self.assert_valid_response(response, status.HTTP_200_OK)
user.refresh_from_db()
self.assertTrue(user.is_active)
Expand Down

0 comments on commit 1516ac9

Please sign in to comment.