Merge pull request #21113 from edx/INCR-444

INCR-444 Python 3 compatibility
This commit is contained in:
Aarif
2019-07-25 12:43:33 +05:00
committed by GitHub
6 changed files with 20 additions and 9 deletions

View File

@@ -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__)

View File

@@ -1,6 +1,8 @@
"""
Factories related to student verification.
"""
from __future__ import absolute_import
from datetime import timedelta
from django.conf import settings

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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