From f7ed283e562aca4aa57eff12df0b75d1406b25fe Mon Sep 17 00:00:00 2001 From: Mayank Jain Date: Tue, 7 May 2019 01:51:50 -0400 Subject: [PATCH] run modernizer on djangoapps-credentials migration, test & setting (#20428) --- .../core/djangoapps/credentials/migrations/0001_initial.py | 4 ++-- .../credentials/migrations/0002_auto_20160325_0631.py | 2 +- .../credentials/migrations/0003_auto_20170525_1109.py | 2 +- .../credentials/migrations/0004_notifycredentialsconfig.py | 4 ++-- openedx/core/djangoapps/credentials/tests/factories.py | 7 +++---- openedx/core/djangoapps/credentials/tests/mixins.py | 2 ++ openedx/core/djangoapps/credentials/tests/test_models.py | 2 ++ openedx/core/djangoapps/credentials/tests/test_signals.py | 3 ++- openedx/core/djangoapps/credentials/tests/test_tasks.py | 4 +++- openedx/core/djangoapps/credentials/tests/test_utils.py | 7 ++++--- 10 files changed, 22 insertions(+), 15 deletions(-) diff --git a/openedx/core/djangoapps/credentials/migrations/0001_initial.py b/openedx/core/djangoapps/credentials/migrations/0001_initial.py index 02ed45cb05..d800abb502 100644 --- a/openedx/core/djangoapps/credentials/migrations/0001_initial.py +++ b/openedx/core/djangoapps/credentials/migrations/0001_initial.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals -from django.db import migrations, models import django.db.models.deletion from django.conf import settings +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/openedx/core/djangoapps/credentials/migrations/0002_auto_20160325_0631.py b/openedx/core/djangoapps/credentials/migrations/0002_auto_20160325_0631.py index 5cafeda4e1..7d14b3d9cf 100644 --- a/openedx/core/djangoapps/credentials/migrations/0002_auto_20160325_0631.py +++ b/openedx/core/djangoapps/credentials/migrations/0002_auto_20160325_0631.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals from django.db import migrations, models diff --git a/openedx/core/djangoapps/credentials/migrations/0003_auto_20170525_1109.py b/openedx/core/djangoapps/credentials/migrations/0003_auto_20170525_1109.py index 6c5acb7935..3532f681bc 100644 --- a/openedx/core/djangoapps/credentials/migrations/0003_auto_20170525_1109.py +++ b/openedx/core/djangoapps/credentials/migrations/0003_auto_20170525_1109.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals from django.db import migrations, models diff --git a/openedx/core/djangoapps/credentials/migrations/0004_notifycredentialsconfig.py b/openedx/core/djangoapps/credentials/migrations/0004_notifycredentialsconfig.py index d1defe9887..50998a2930 100644 --- a/openedx/core/djangoapps/credentials/migrations/0004_notifycredentialsconfig.py +++ b/openedx/core/djangoapps/credentials/migrations/0004_notifycredentialsconfig.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2018-08-17 18:14 -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): diff --git a/openedx/core/djangoapps/credentials/tests/factories.py b/openedx/core/djangoapps/credentials/tests/factories.py index fba8c9d9e6..150905bcf6 100644 --- a/openedx/core/djangoapps/credentials/tests/factories.py +++ b/openedx/core/djangoapps/credentials/tests/factories.py @@ -1,12 +1,11 @@ """Factories for generating fake credentials-related data.""" # pylint: disable=missing-docstring, invalid-name +from __future__ import absolute_import + import factory -from openedx.core.djangoapps.catalog.tests.factories import ( - generate_course_run_key, - DictFactoryBase, -) +from openedx.core.djangoapps.catalog.tests.factories import DictFactoryBase, generate_course_run_key class ProgramCredential(DictFactoryBase): diff --git a/openedx/core/djangoapps/credentials/tests/mixins.py b/openedx/core/djangoapps/credentials/tests/mixins.py index 6ac150ed97..cf26daeb5b 100644 --- a/openedx/core/djangoapps/credentials/tests/mixins.py +++ b/openedx/core/djangoapps/credentials/tests/mixins.py @@ -1,5 +1,7 @@ """Mixins for use during testing.""" +from __future__ import absolute_import + from openedx.core.djangoapps.credentials.models import CredentialsApiConfig diff --git a/openedx/core/djangoapps/credentials/tests/test_models.py b/openedx/core/djangoapps/credentials/tests/test_models.py index 549e47a9c7..59eba16c50 100644 --- a/openedx/core/djangoapps/credentials/tests/test_models.py +++ b/openedx/core/djangoapps/credentials/tests/test_models.py @@ -1,5 +1,7 @@ """Tests for models supporting Credentials-related functionality.""" +from __future__ import absolute_import + from django.test import TestCase, override_settings from openedx.core.djangoapps.credentials.models import API_VERSION diff --git a/openedx/core/djangoapps/credentials/tests/test_signals.py b/openedx/core/djangoapps/credentials/tests/test_signals.py index b96aa5fdd1..e70725d4e8 100644 --- a/openedx/core/djangoapps/credentials/tests/test_signals.py +++ b/openedx/core/djangoapps/credentials/tests/test_signals.py @@ -1,4 +1,6 @@ """Tests covering Credentials signals.""" +from __future__ import absolute_import + import ddt import mock from django.conf import settings @@ -16,7 +18,6 @@ from student.tests.factories import UserFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory as XModuleCourseFactory - SIGNALS_MODULE = 'openedx.core.djangoapps.credentials.signals' diff --git a/openedx/core/djangoapps/credentials/tests/test_tasks.py b/openedx/core/djangoapps/credentials/tests/test_tasks.py index 7f111cafd3..ce14649bf9 100644 --- a/openedx/core/djangoapps/credentials/tests/test_tasks.py +++ b/openedx/core/djangoapps/credentials/tests/test_tasks.py @@ -1,9 +1,11 @@ """ Test credentials tasks """ +from __future__ import absolute_import + import mock from django.conf import settings -from django.test import override_settings, TestCase +from django.test import TestCase, override_settings from openedx.core.djangolib.testing.utils import skip_unless_lms from student.tests.factories import UserFactory diff --git a/openedx/core/djangoapps/credentials/tests/test_utils.py b/openedx/core/djangoapps/credentials/tests/test_utils.py index 7bba98bf86..95ddbb0850 100644 --- a/openedx/core/djangoapps/credentials/tests/test_utils.py +++ b/openedx/core/djangoapps/credentials/tests/test_utils.py @@ -1,18 +1,19 @@ """Tests covering Credentials utilities.""" +from __future__ import absolute_import + import uuid -from edx_oauth2_provider.tests.factories import ClientFactory import mock +from edx_oauth2_provider.tests.factories import ClientFactory from provider.constants import CONFIDENTIAL from openedx.core.djangoapps.credentials.models import CredentialsApiConfig +from openedx.core.djangoapps.credentials.tests import factories from openedx.core.djangoapps.credentials.tests.mixins import CredentialsApiConfigMixin from openedx.core.djangoapps.credentials.utils import get_credentials -from openedx.core.djangoapps.credentials.tests import factories from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_unless_lms from student.tests.factories import UserFactory - UTILS_MODULE = 'openedx.core.djangoapps.credentials.utils'