From 8f6569f462138a6b18a47589d2fe3dd957891170 Mon Sep 17 00:00:00 2001 From: aarif Date: Fri, 12 Jul 2019 16:11:19 +0500 Subject: [PATCH] ran python-modernize and isort on files mentioned in INCR-444 changes made to comply with quality --- lms/djangoapps/verify_student/models.py | 7 +++---- lms/djangoapps/verify_student/tests/factories.py | 2 ++ .../tests/test_fake_software_secure.py | 2 ++ lms/djangoapps/verify_student/tests/test_models.py | 12 ++++++++---- lms/djangoapps/verify_student/tests/test_services.py | 4 +++- lms/djangoapps/verify_student/tests/test_signals.py | 2 ++ 6 files changed, 20 insertions(+), 9 deletions(-) diff --git a/lms/djangoapps/verify_student/models.py b/lms/djangoapps/verify_student/models.py index 99dd2fbd3c..c9fbff2316 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 feeca85d9b..844f608329 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 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. @@ -423,6 +425,7 @@ class SSOVerificationTest(TestVerification): """ Tests for the SSOVerification model """ + def test_active_at_datetime(self): user = UserFactory.create() attempt = SSOVerification.objects.create(user=user) @@ -433,6 +436,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