summaryrefslogtreecommitdiff
path: root/tests/auth_tests
diff options
context:
space:
mode:
authorCurtis Maloney <curtis@tinbrain.net>2015-04-09 10:32:55 +1000
committerCurtis Maloney <curtis@tinbrain.net>2015-04-09 11:16:12 +1000
commit88d7fcebdebb726c6dc561bcce7916ed1d5256d7 (patch)
tree65c929e4bc12d9b3182437d24f3931b5804757ea /tests/auth_tests
parent0824c026035b75b3aa32ad9b19b700fed487de27 (diff)
Use mock.patch in migrations tests
Currently some of the migrations tests rely on the fact 'input' is aliased because of six, instead of using mock.patch. Replace this code with proper use of mock.patch. Also, replace one case of excessively specific python version check with testing six.PY3
Diffstat (limited to 'tests/auth_tests')
-rw-r--r--tests/auth_tests/test_tokens.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auth_tests/test_tokens.py b/tests/auth_tests/test_tokens.py
index f2b94a35f8..fa26f223f7 100644
--- a/tests/auth_tests/test_tokens.py
+++ b/tests/auth_tests/test_tokens.py
@@ -1,4 +1,3 @@
-import sys
import unittest
from datetime import date, timedelta
@@ -6,6 +5,7 @@ from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.test import TestCase
+from django.utils.six import PY3
class TokenGeneratorTest(TestCase):
@@ -54,7 +54,7 @@ class TokenGeneratorTest(TestCase):
p2 = Mocked(date.today() + timedelta(settings.PASSWORD_RESET_TIMEOUT_DAYS + 1))
self.assertFalse(p2.check_token(user, tk1))
- @unittest.skipIf(sys.version_info[:2] >= (3, 0), "Unnecessary test with Python 3")
+ @unittest.skipIf(PY3, "Unnecessary test with Python 3")
def test_date_length(self):
"""
Make sure we don't allow overly long dates, causing a potential DoS.