diff --git a/lms/djangoapps/verify_student/models.py b/lms/djangoapps/verify_student/models.py index 4675102915..e6aba8da2d 100644 --- a/lms/djangoapps/verify_student/models.py +++ b/lms/djangoapps/verify_student/models.py @@ -8,6 +8,8 @@ of a student over a period of time. Right now, the only models are the abstract `SoftwareSecurePhotoVerification`. The hope is to keep as much of the photo verification process as generic as possible. """ +from __future__ import absolute_import + import functools import json import logging @@ -20,11 +22,9 @@ import requests import six from django.conf import settings from django.contrib.auth.models import User -from django.core.cache import cache from django.core.files.base import ContentFile -from django.urls import reverse from django.db import models -from django.dispatch import receiver +from django.urls import reverse from django.utils.functional import cached_property from django.utils.timezone import now from django.utils.translation import ugettext_lazy @@ -40,7 +40,6 @@ from lms.djangoapps.verify_student.ssencrypt import ( ) from openedx.core.djangoapps.signals.signals import LEARNER_NOW_VERIFIED from openedx.core.storage import get_storage - from .utils import earliest_allowed_verification_date log = logging.getLogger(__name__) diff --git a/lms/djangoapps/verify_student/tests/factories.py b/lms/djangoapps/verify_student/tests/factories.py index 581768f607..baae3033ae 100644 --- a/lms/djangoapps/verify_student/tests/factories.py +++ b/lms/djangoapps/verify_student/tests/factories.py @@ -1,6 +1,8 @@ """ Factories related to student verification. """ +from __future__ import absolute_import + from datetime import timedelta from django.conf import settings diff --git a/lms/djangoapps/verify_student/tests/test_fake_software_secure.py b/lms/djangoapps/verify_student/tests/test_fake_software_secure.py index 6718cd0407..43a22bf7f4 100644 --- a/lms/djangoapps/verify_student/tests/test_fake_software_secure.py +++ b/lms/djangoapps/verify_student/tests/test_fake_software_secure.py @@ -2,6 +2,8 @@ Tests for the fake software secure response. """ +from __future__ import absolute_import + from django.test import TestCase from mock import patch diff --git a/lms/djangoapps/verify_student/tests/test_models.py b/lms/djangoapps/verify_student/tests/test_models.py index a8dd45b88e..d1d59baa94 100644 --- a/lms/djangoapps/verify_student/tests/test_models.py +++ b/lms/djangoapps/verify_student/tests/test_models.py @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- +from __future__ import absolute_import + import json from datetime import datetime, timedelta @@ -11,8 +13,10 @@ from django.test import TestCase from django.utils.timezone import now from freezegun import freeze_time from mock import patch -from opaque_keys.edx.keys import CourseKey +from six.moves import range +from student.tests.factories import UserFactory from testfixtures import LogCapture +from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from common.test.utils import MockS3Mixin from lms.djangoapps.verify_student.models import ( @@ -21,9 +25,6 @@ from lms.djangoapps.verify_student.models import ( ManualVerification, VerificationException, ) -from openedx.core.djangolib.testing.utils import CacheIsolationTestCase -from student.tests.factories import UserFactory -from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase FAKE_SETTINGS = { "SOFTWARE_SECURE": { @@ -93,6 +94,7 @@ class TestVerification(TestCase): """ Common tests across all types of Verications (e.g., SoftwareSecurePhotoVerication, SSOVerification) """ + def verification_active_at_datetime(self, attempt): """ Tests to ensure the Verification is active or inactive at the appropriate datetimes. @@ -443,6 +445,7 @@ class SSOVerificationTest(TestVerification): """ Tests for the SSOVerification model """ + def test_active_at_datetime(self): user = UserFactory.create() attempt = SSOVerification.objects.create(user=user) @@ -453,6 +456,7 @@ class ManualVerificationTest(TestVerification): """ Tests for the ManualVerification model """ + def test_active_at_datetime(self): user = UserFactory.create() verification = ManualVerification.objects.create(user=user) diff --git a/lms/djangoapps/verify_student/tests/test_services.py b/lms/djangoapps/verify_student/tests/test_services.py index 114d0c6d6b..7f80dea0f3 100644 --- a/lms/djangoapps/verify_student/tests/test_services.py +++ b/lms/djangoapps/verify_student/tests/test_services.py @@ -3,12 +3,14 @@ Tests for the service classes in verify_student. """ +from __future__ import absolute_import + import ddt from django.conf import settings from mock import patch from common.test.utils import MockS3Mixin -from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification, SSOVerification, ManualVerification +from lms.djangoapps.verify_student.models import ManualVerification, SoftwareSecurePhotoVerification, SSOVerification from lms.djangoapps.verify_student.services import IDVerificationService from student.tests.factories import UserFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase diff --git a/lms/djangoapps/verify_student/tests/test_signals.py b/lms/djangoapps/verify_student/tests/test_signals.py index cddce181ea..8e794c943d 100644 --- a/lms/djangoapps/verify_student/tests/test_signals.py +++ b/lms/djangoapps/verify_student/tests/test_signals.py @@ -2,6 +2,8 @@ Unit tests for the VerificationDeadline signals """ +from __future__ import absolute_import + from datetime import timedelta from django.utils.timezone import now