From e1ed3211c1dbde4b3013977de9f14f5580b2e750 Mon Sep 17 00:00:00 2001 From: usamasadiq Date: Thu, 4 Feb 2021 14:49:54 +0500 Subject: [PATCH] Applied pylint-amnesty to common/djangoapps/entitlements --- common/djangoapps/entitlements/admin.py | 2 +- common/djangoapps/entitlements/api.py | 2 +- common/djangoapps/entitlements/apps.py | 2 +- .../commands/expire_old_entitlements.py | 1 + .../tests/test_expire_old_entitlements.py | 2 +- .../commands/update_entitlement_mode.py | 1 + .../entitlements/migrations/0001_initial.py | 10 ++++---- .../migrations/0002_auto_20171102_0719.py | 6 ++--- .../migrations/0003_auto_20171205_1431.py | 16 ++++++------- .../migrations/0004_auto_20171206_1729.py | 4 ++-- .../0005_courseentitlementsupportdetail.py | 12 +++++----- ...6_courseentitlementsupportdetail_action.py | 6 ++--- .../0007_change_expiration_period_default.py | 6 ++--- .../migrations/0008_auto_20180328_1107.py | 6 ++--- .../0009_courseentitlement_refund_locked.py | 4 ++-- .../migrations/0010_backfill_refund_lock.py | 12 +++++----- .../0011_historicalcourseentitlement.py | 24 +++++++++---------- .../0012_allow_blank_order_number_values.py | 4 ++-- ...istoricalcourseentitlementsupportdetail.py | 22 ++++++++--------- .../migrations/0014_auto_20200115_2022.py | 6 ++--- .../0015_add_unique_together_constraint.py | 4 ++-- common/djangoapps/entitlements/models.py | 2 +- .../entitlements/rest_api/v1/filters.py | 4 ++-- .../rest_api/v1/tests/test_serializers.py | 2 +- .../rest_api/v1/tests/test_views.py | 10 ++++---- .../entitlements/rest_api/v1/views.py | 8 +++---- common/djangoapps/entitlements/signals.py | 2 +- common/djangoapps/entitlements/tasks.py | 6 ++--- .../entitlements/tests/factories.py | 4 ++-- .../entitlements/tests/test_models.py | 10 ++++---- .../entitlements/tests/test_tasks.py | 2 +- .../entitlements/tests/test_utils.py | 6 ++--- common/djangoapps/entitlements/utils.py | 2 +- 33 files changed, 106 insertions(+), 104 deletions(-) diff --git a/common/djangoapps/entitlements/admin.py b/common/djangoapps/entitlements/admin.py index be8d6a4ade..1a060d714d 100644 --- a/common/djangoapps/entitlements/admin.py +++ b/common/djangoapps/entitlements/admin.py @@ -1,4 +1,4 @@ -"""Admin forms for Course Entitlements""" +"""Admin forms for Course Entitlements""" # lint-amnesty, pylint: disable=django-not-configured from django import forms diff --git a/common/djangoapps/entitlements/api.py b/common/djangoapps/entitlements/api.py index bf55a8e0d5..2b31d5a3a9 100644 --- a/common/djangoapps/entitlements/api.py +++ b/common/djangoapps/entitlements/api.py @@ -1,4 +1,4 @@ -""" +""" # lint-amnesty, pylint: disable=django-not-configured Python APIs exposed by the Entitlements app to other in-process apps. """ diff --git a/common/djangoapps/entitlements/apps.py b/common/djangoapps/entitlements/apps.py index 40a3d55e94..06155e60e4 100644 --- a/common/djangoapps/entitlements/apps.py +++ b/common/djangoapps/entitlements/apps.py @@ -1,4 +1,4 @@ -""" +""" # lint-amnesty, pylint: disable=django-not-configured Entitlements Application Configuration Signal handlers are connected here. diff --git a/common/djangoapps/entitlements/management/commands/expire_old_entitlements.py b/common/djangoapps/entitlements/management/commands/expire_old_entitlements.py index 6965a457fb..074536f8b4 100644 --- a/common/djangoapps/entitlements/management/commands/expire_old_entitlements.py +++ b/common/djangoapps/entitlements/management/commands/expire_old_entitlements.py @@ -1,3 +1,4 @@ +# lint-amnesty, pylint: disable=django-not-configured """ Management command for expiring old entitlements. """ diff --git a/common/djangoapps/entitlements/management/commands/tests/test_expire_old_entitlements.py b/common/djangoapps/entitlements/management/commands/tests/test_expire_old_entitlements.py index fb9663dadd..7f6f326b0f 100644 --- a/common/djangoapps/entitlements/management/commands/tests/test_expire_old_entitlements.py +++ b/common/djangoapps/entitlements/management/commands/tests/test_expire_old_entitlements.py @@ -1,4 +1,4 @@ -"""Test Entitlements models""" +"""Test Entitlements models""" # lint-amnesty, pylint: disable=django-not-configured import mock diff --git a/common/djangoapps/entitlements/management/commands/update_entitlement_mode.py b/common/djangoapps/entitlements/management/commands/update_entitlement_mode.py index 0b97ce463a..eeb26a26f4 100644 --- a/common/djangoapps/entitlements/management/commands/update_entitlement_mode.py +++ b/common/djangoapps/entitlements/management/commands/update_entitlement_mode.py @@ -1,3 +1,4 @@ +# lint-amnesty, pylint: disable=django-not-configured """ Management command for updating entitlements modes. """ diff --git a/common/djangoapps/entitlements/migrations/0001_initial.py b/common/djangoapps/entitlements/migrations/0001_initial.py index 51c2fb2d69..9cad0f4eb5 100644 --- a/common/djangoapps/entitlements/migrations/0001_initial.py +++ b/common/djangoapps/entitlements/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=django-not-configured, missing-module-docstring import uuid @@ -9,7 +9,7 @@ from django.conf import settings from django.db import migrations, models -class Migration(migrations.Migration): +class Migration(migrations.Migration): # lint-amnesty, pylint: disable=missing-class-docstring dependencies = [ ('student', '0013_delete_historical_enrollment_records'), @@ -21,14 +21,14 @@ class Migration(migrations.Migration): name='CourseEntitlement', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)), - ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), + ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)), # lint-amnesty, pylint: disable=line-too-long + ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), # lint-amnesty, pylint: disable=line-too-long ('uuid', models.UUIDField(default=uuid.uuid4, editable=False)), ('course_uuid', models.UUIDField()), ('expired_at', models.DateTimeField(null=True)), ('mode', models.CharField(default=u'audit', max_length=100)), ('order_number', models.CharField(max_length=128, null=True)), - ('enrollment_course_run', models.ForeignKey(to='student.CourseEnrollment', null=True, on_delete=models.CASCADE)), + ('enrollment_course_run', models.ForeignKey(to='student.CourseEnrollment', null=True, on_delete=models.CASCADE)), # lint-amnesty, pylint: disable=line-too-long ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ], options={ diff --git a/common/djangoapps/entitlements/migrations/0002_auto_20171102_0719.py b/common/djangoapps/entitlements/migrations/0002_auto_20171102_0719.py index 6dfb5218da..f857cb1dd3 100644 --- a/common/djangoapps/entitlements/migrations/0002_auto_20171102_0719.py +++ b/common/djangoapps/entitlements/migrations/0002_auto_20171102_0719.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring from django.db import migrations, models @@ -22,12 +22,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='courseentitlement', name='enrollment_course_run', - field=models.ForeignKey(to='student.CourseEnrollment', help_text=u'The current Course enrollment for this entitlement. If NULL the Learner has not enrolled.', null=True, on_delete=models.CASCADE), + field=models.ForeignKey(to='student.CourseEnrollment', help_text=u'The current Course enrollment for this entitlement. If NULL the Learner has not enrolled.', null=True, on_delete=models.CASCADE), # lint-amnesty, pylint: disable=line-too-long ), migrations.AlterField( model_name='courseentitlement', name='expired_at', - field=models.DateTimeField(help_text=u'The date that an entitlement expired, if NULL the entitlement has not expired.', null=True), + field=models.DateTimeField(help_text=u'The date that an entitlement expired, if NULL the entitlement has not expired.', null=True), # lint-amnesty, pylint: disable=line-too-long ), migrations.AlterField( model_name='courseentitlement', diff --git a/common/djangoapps/entitlements/migrations/0003_auto_20171205_1431.py b/common/djangoapps/entitlements/migrations/0003_auto_20171205_1431.py index af8cae0cc5..5c1db71a05 100644 --- a/common/djangoapps/entitlements/migrations/0003_auto_20171205_1431.py +++ b/common/djangoapps/entitlements/migrations/0003_auto_20171205_1431.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring import datetime @@ -6,7 +6,7 @@ import datetime from django.db import migrations, models -class Migration(migrations.Migration): +class Migration(migrations.Migration): # lint-amnesty, pylint: disable=missing-class-docstring dependencies = [ ('sites', '0001_initial'), @@ -18,25 +18,25 @@ class Migration(migrations.Migration): name='CourseEntitlementPolicy', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('expiration_period', models.DurationField(default=datetime.timedelta(450), help_text=u'Duration in days from when an entitlement is created until when it is expired.')), - ('refund_period', models.DurationField(default=datetime.timedelta(60), help_text=u'Duration in days from when an entitlement is created until when it is no longer refundable')), - ('regain_period', models.DurationField(default=datetime.timedelta(14), help_text=u'Duration in days from when an entitlement is redeemed for a course run until it is no longer able to be regained by a user.')), + ('expiration_period', models.DurationField(default=datetime.timedelta(450), help_text=u'Duration in days from when an entitlement is created until when it is expired.')), # lint-amnesty, pylint: disable=line-too-long + ('refund_period', models.DurationField(default=datetime.timedelta(60), help_text=u'Duration in days from when an entitlement is created until when it is no longer refundable')), # lint-amnesty, pylint: disable=line-too-long + ('regain_period', models.DurationField(default=datetime.timedelta(14), help_text=u'Duration in days from when an entitlement is redeemed for a course run until it is no longer able to be regained by a user.')), # lint-amnesty, pylint: disable=line-too-long ('site', models.ForeignKey(to='sites.Site', on_delete=models.CASCADE)), ], ), migrations.AlterField( model_name='courseentitlement', name='enrollment_course_run', - field=models.ForeignKey(blank=True, to='student.CourseEnrollment', help_text=u'The current Course enrollment for this entitlement. If NULL the Learner has not enrolled.', null=True, on_delete=models.CASCADE), + field=models.ForeignKey(blank=True, to='student.CourseEnrollment', help_text=u'The current Course enrollment for this entitlement. If NULL the Learner has not enrolled.', null=True, on_delete=models.CASCADE), # lint-amnesty, pylint: disable=line-too-long ), migrations.AlterField( model_name='courseentitlement', name='expired_at', - field=models.DateTimeField(help_text=u'The date that an entitlement expired, if NULL the entitlement has not expired.', null=True, blank=True), + field=models.DateTimeField(help_text=u'The date that an entitlement expired, if NULL the entitlement has not expired.', null=True, blank=True), # lint-amnesty, pylint: disable=line-too-long ), migrations.AddField( model_name='courseentitlement', name='_policy', - field=models.ForeignKey(blank=True, to='entitlements.CourseEntitlementPolicy', null=True, on_delete=models.CASCADE), + field=models.ForeignKey(blank=True, to='entitlements.CourseEntitlementPolicy', null=True, on_delete=models.CASCADE), # lint-amnesty, pylint: disable=line-too-long ), ] diff --git a/common/djangoapps/entitlements/migrations/0004_auto_20171206_1729.py b/common/djangoapps/entitlements/migrations/0004_auto_20171206_1729.py index 81836f3ac3..a47b3ff312 100644 --- a/common/djangoapps/entitlements/migrations/0004_auto_20171206_1729.py +++ b/common/djangoapps/entitlements/migrations/0004_auto_20171206_1729.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring import uuid @@ -6,7 +6,7 @@ import uuid from django.db import migrations, models -class Migration(migrations.Migration): +class Migration(migrations.Migration): # lint-amnesty, pylint: disable=missing-class-docstring dependencies = [ ('entitlements', '0003_auto_20171205_1431'), diff --git a/common/djangoapps/entitlements/migrations/0005_courseentitlementsupportdetail.py b/common/djangoapps/entitlements/migrations/0005_courseentitlementsupportdetail.py index 8dfcb89a21..5c10116dea 100644 --- a/common/djangoapps/entitlements/migrations/0005_courseentitlementsupportdetail.py +++ b/common/djangoapps/entitlements/migrations/0005_courseentitlementsupportdetail.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring import django.utils.timezone @@ -7,7 +7,7 @@ from django.conf import settings from django.db import migrations, models -class Migration(migrations.Migration): +class Migration(migrations.Migration): # lint-amnesty, pylint: disable=missing-class-docstring dependencies = [ ('course_overviews', '0014_courseoverview_certificate_available_date'), @@ -20,13 +20,13 @@ class Migration(migrations.Migration): name='CourseEntitlementSupportDetail', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)), - ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), - ('reason', models.CharField(max_length=15, choices=[(u'LEAVE', 'Learner requested leave session for expired entitlement'), (u'CHANGE', 'Learner requested session change for expired entitlement'), (u'LEARNER_NEW', 'Learner requested new entitlement'), (u'COURSE_TEAM_NEW', 'Course team requested entitlement for learnerg'), (u'OTHER', 'Other')])), + ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)), # lint-amnesty, pylint: disable=line-too-long + ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), # lint-amnesty, pylint: disable=line-too-long + ('reason', models.CharField(max_length=15, choices=[(u'LEAVE', 'Learner requested leave session for expired entitlement'), (u'CHANGE', 'Learner requested session change for expired entitlement'), (u'LEARNER_NEW', 'Learner requested new entitlement'), (u'COURSE_TEAM_NEW', 'Course team requested entitlement for learnerg'), (u'OTHER', 'Other')])), # lint-amnesty, pylint: disable=line-too-long ('comments', models.TextField(null=True)), ('entitlement', models.ForeignKey(to='entitlements.CourseEntitlement', on_delete=models.CASCADE)), ('support_user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), - ('unenrolled_run', models.ForeignKey(db_constraint=False, blank=True, to='course_overviews.CourseOverview', null=True, on_delete=models.CASCADE)), + ('unenrolled_run', models.ForeignKey(db_constraint=False, blank=True, to='course_overviews.CourseOverview', null=True, on_delete=models.CASCADE)), # lint-amnesty, pylint: disable=line-too-long ], options={ 'abstract': False, diff --git a/common/djangoapps/entitlements/migrations/0006_courseentitlementsupportdetail_action.py b/common/djangoapps/entitlements/migrations/0006_courseentitlementsupportdetail_action.py index a390465e48..c4750c7cf1 100644 --- a/common/djangoapps/entitlements/migrations/0006_courseentitlementsupportdetail_action.py +++ b/common/djangoapps/entitlements/migrations/0006_courseentitlementsupportdetail_action.py @@ -1,10 +1,10 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring from django.db import migrations, models -class Migration(migrations.Migration): +class Migration(migrations.Migration): # lint-amnesty, pylint: disable=missing-class-docstring dependencies = [ ('entitlements', '0005_courseentitlementsupportdetail'), @@ -14,7 +14,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='courseentitlementsupportdetail', name='action', - field=models.CharField(default='CREATE', max_length=15, choices=[(u'REISSUE', u'Re-issue entitlement'), (u'CREATE', u'Create new entitlement')]), + field=models.CharField(default='CREATE', max_length=15, choices=[(u'REISSUE', u'Re-issue entitlement'), (u'CREATE', u'Create new entitlement')]), # lint-amnesty, pylint: disable=line-too-long preserve_default=False, ), ] diff --git a/common/djangoapps/entitlements/migrations/0007_change_expiration_period_default.py b/common/djangoapps/entitlements/migrations/0007_change_expiration_period_default.py index a32f5b691d..73b9a6fd2c 100644 --- a/common/djangoapps/entitlements/migrations/0007_change_expiration_period_default.py +++ b/common/djangoapps/entitlements/migrations/0007_change_expiration_period_default.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring import datetime @@ -6,7 +6,7 @@ import datetime from django.db import migrations, models -class Migration(migrations.Migration): +class Migration(migrations.Migration): # lint-amnesty, pylint: disable=missing-class-docstring dependencies = [ ('entitlements', '0006_courseentitlementsupportdetail_action'), @@ -16,6 +16,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='courseentitlementpolicy', name='expiration_period', - field=models.DurationField(default=datetime.timedelta(730), help_text=u'Duration in days from when an entitlement is created until when it is expired.'), + field=models.DurationField(default=datetime.timedelta(730), help_text=u'Duration in days from when an entitlement is created until when it is expired.'), # lint-amnesty, pylint: disable=line-too-long ), ] diff --git a/common/djangoapps/entitlements/migrations/0008_auto_20180328_1107.py b/common/djangoapps/entitlements/migrations/0008_auto_20180328_1107.py index 1733c64b40..f9118dc3bb 100644 --- a/common/djangoapps/entitlements/migrations/0008_auto_20180328_1107.py +++ b/common/djangoapps/entitlements/migrations/0008_auto_20180328_1107.py @@ -1,10 +1,10 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring from django.db import migrations, models -class Migration(migrations.Migration): +class Migration(migrations.Migration): # lint-amnesty, pylint: disable=missing-class-docstring dependencies = [ ('entitlements', '0007_change_expiration_period_default'), @@ -14,7 +14,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='courseentitlementpolicy', name='mode', - field=models.CharField(max_length=32, null=True, choices=[(None, u'---------'), (u'verified', u'verified'), (u'professional', u'professional')]), + field=models.CharField(max_length=32, null=True, choices=[(None, u'---------'), (u'verified', u'verified'), (u'professional', u'professional')]), # lint-amnesty, pylint: disable=line-too-long ), migrations.AlterField( model_name='courseentitlementpolicy', diff --git a/common/djangoapps/entitlements/migrations/0009_courseentitlement_refund_locked.py b/common/djangoapps/entitlements/migrations/0009_courseentitlement_refund_locked.py index 74ae85e059..dd863e260f 100644 --- a/common/djangoapps/entitlements/migrations/0009_courseentitlement_refund_locked.py +++ b/common/djangoapps/entitlements/migrations/0009_courseentitlement_refund_locked.py @@ -1,11 +1,11 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring # Generated by Django 1.11.12 on 2018-04-12 12:00 from django.db import migrations, models -class Migration(migrations.Migration): +class Migration(migrations.Migration): # lint-amnesty, pylint: disable=missing-class-docstring dependencies = [ ('entitlements', '0008_auto_20180328_1107'), diff --git a/common/djangoapps/entitlements/migrations/0010_backfill_refund_lock.py b/common/djangoapps/entitlements/migrations/0010_backfill_refund_lock.py index cacb7f8271..e4e545a975 100644 --- a/common/djangoapps/entitlements/migrations/0010_backfill_refund_lock.py +++ b/common/djangoapps/entitlements/migrations/0010_backfill_refund_lock.py @@ -1,26 +1,26 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring -from datetime import datetime +from datetime import datetime # lint-amnesty, pylint: disable=unused-import -from django.db import migrations, models +from django.db import migrations, models # lint-amnesty, pylint: disable=unused-import -def backfill_refundability(apps, schema_editor): +def backfill_refundability(apps, schema_editor): # lint-amnesty, pylint: disable=unused-argument CourseEntitlementSupportDetail = apps.get_model('entitlements', 'CourseEntitlementSupportDetail') for support_detail in CourseEntitlementSupportDetail.objects.all().select_related('entitlement'): support_detail.entitlement.refund_locked = True support_detail.entitlement.save() -def revert_backfill(apps, schema_editor): +def revert_backfill(apps, schema_editor): # lint-amnesty, pylint: disable=unused-argument CourseEntitlementSupportDetail = apps.get_model('entitlements', 'CourseEntitlementSupportDetail') for support_detail in CourseEntitlementSupportDetail.objects.all().select_related('entitlement'): support_detail.entitlement.refund_locked = False support_detail.entitlement.save() -class Migration(migrations.Migration): +class Migration(migrations.Migration): # lint-amnesty, pylint: disable=missing-class-docstring dependencies = [ ('entitlements', '0009_courseentitlement_refund_locked'), diff --git a/common/djangoapps/entitlements/migrations/0011_historicalcourseentitlement.py b/common/djangoapps/entitlements/migrations/0011_historicalcourseentitlement.py index d39484af02..ae7f9be699 100644 --- a/common/djangoapps/entitlements/migrations/0011_historicalcourseentitlement.py +++ b/common/djangoapps/entitlements/migrations/0011_historicalcourseentitlement.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring # Generated by Django 1.11.20 on 2019-05-30 21:13 @@ -8,10 +8,10 @@ import django.db.models.deletion import django.utils.timezone import model_utils.fields import simple_history.models -import uuid +import uuid # lint-amnesty, pylint: disable=wrong-import-order -class Migration(migrations.Migration): +class Migration(migrations.Migration): # lint-amnesty, pylint: disable=missing-class-docstring dependencies = [ ('student', '0021_historicalcourseenrollment'), @@ -24,22 +24,22 @@ class Migration(migrations.Migration): name='HistoricalCourseEntitlement', fields=[ ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')), - ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')), - ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')), + ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')), # lint-amnesty, pylint: disable=line-too-long + ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')), # lint-amnesty, pylint: disable=line-too-long ('uuid', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False)), ('course_uuid', models.UUIDField(help_text=u'UUID for the Course, not the Course Run')), - ('expired_at', models.DateTimeField(blank=True, help_text=u'The date that an entitlement expired, if NULL the entitlement has not expired.', null=True)), - ('mode', models.CharField(help_text=u'The mode of the Course that will be applied on enroll.', max_length=100)), + ('expired_at', models.DateTimeField(blank=True, help_text=u'The date that an entitlement expired, if NULL the entitlement has not expired.', null=True)), # lint-amnesty, pylint: disable=line-too-long + ('mode', models.CharField(help_text=u'The mode of the Course that will be applied on enroll.', max_length=100)), # lint-amnesty, pylint: disable=line-too-long ('order_number', models.CharField(max_length=128, null=True)), ('refund_locked', models.BooleanField(default=False)), ('history_id', models.AutoField(primary_key=True, serialize=False)), ('history_date', models.DateTimeField()), ('history_change_reason', models.CharField(max_length=100, null=True)), - ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), - ('_policy', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='entitlements.CourseEntitlementPolicy')), - ('enrollment_course_run', models.ForeignKey(blank=True, db_constraint=False, help_text=u'The current Course enrollment for this entitlement. If NULL the Learner has not enrolled.', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='student.CourseEnrollment')), - ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), - ('user', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)), + ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), # lint-amnesty, pylint: disable=line-too-long + ('_policy', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='entitlements.CourseEntitlementPolicy')), # lint-amnesty, pylint: disable=line-too-long + ('enrollment_course_run', models.ForeignKey(blank=True, db_constraint=False, help_text=u'The current Course enrollment for this entitlement. If NULL the Learner has not enrolled.', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='student.CourseEnrollment')), # lint-amnesty, pylint: disable=line-too-long + ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), # lint-amnesty, pylint: disable=line-too-long + ('user', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)), # lint-amnesty, pylint: disable=line-too-long ], options={ 'ordering': ('-history_date', '-history_id'), diff --git a/common/djangoapps/entitlements/migrations/0012_allow_blank_order_number_values.py b/common/djangoapps/entitlements/migrations/0012_allow_blank_order_number_values.py index 278b7d716f..65e0e94adf 100644 --- a/common/djangoapps/entitlements/migrations/0012_allow_blank_order_number_values.py +++ b/common/djangoapps/entitlements/migrations/0012_allow_blank_order_number_values.py @@ -1,11 +1,11 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring # Generated by Django 1.11.25 on 2019-10-23 15:47 from django.db import migrations, models -class Migration(migrations.Migration): +class Migration(migrations.Migration): # lint-amnesty, pylint: disable=missing-class-docstring dependencies = [ ('entitlements', '0011_historicalcourseentitlement'), diff --git a/common/djangoapps/entitlements/migrations/0013_historicalcourseentitlementsupportdetail.py b/common/djangoapps/entitlements/migrations/0013_historicalcourseentitlementsupportdetail.py index fddb220317..4d201efc85 100644 --- a/common/djangoapps/entitlements/migrations/0013_historicalcourseentitlementsupportdetail.py +++ b/common/djangoapps/entitlements/migrations/0013_historicalcourseentitlementsupportdetail.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring # Generated by Django 1.11.26 on 2019-12-17 14:08 @@ -10,7 +10,7 @@ import model_utils.fields import simple_history.models -class Migration(migrations.Migration): +class Migration(migrations.Migration): # lint-amnesty, pylint: disable=missing-class-docstring dependencies = [ ('course_overviews', '0017_auto_20191002_0823'), @@ -23,19 +23,19 @@ class Migration(migrations.Migration): name='HistoricalCourseEntitlementSupportDetail', fields=[ ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')), - ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')), - ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')), - ('reason', models.CharField(choices=[('LEAVE', 'Learner requested leave session for expired entitlement'), ('CHANGE', 'Learner requested session change for expired entitlement'), ('LEARNER_NEW', 'Learner requested new entitlement'), ('COURSE_TEAM_NEW', 'Course team requested entitlement for learnerg'), ('OTHER', 'Other')], max_length=15)), - ('action', models.CharField(choices=[('REISSUE', 'Re-issue entitlement'), ('CREATE', 'Create new entitlement')], max_length=15)), + ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')), # lint-amnesty, pylint: disable=line-too-long + ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')), # lint-amnesty, pylint: disable=line-too-long + ('reason', models.CharField(choices=[('LEAVE', 'Learner requested leave session for expired entitlement'), ('CHANGE', 'Learner requested session change for expired entitlement'), ('LEARNER_NEW', 'Learner requested new entitlement'), ('COURSE_TEAM_NEW', 'Course team requested entitlement for learnerg'), ('OTHER', 'Other')], max_length=15)), # lint-amnesty, pylint: disable=line-too-long + ('action', models.CharField(choices=[('REISSUE', 'Re-issue entitlement'), ('CREATE', 'Create new entitlement')], max_length=15)), # lint-amnesty, pylint: disable=line-too-long ('comments', models.TextField(null=True)), ('history_id', models.AutoField(primary_key=True, serialize=False)), ('history_date', models.DateTimeField()), ('history_change_reason', models.CharField(max_length=100, null=True)), - ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), - ('entitlement', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='entitlements.CourseEntitlement')), - ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), - ('support_user', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)), - ('unenrolled_run', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='course_overviews.CourseOverview')), + ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), # lint-amnesty, pylint: disable=line-too-long + ('entitlement', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='entitlements.CourseEntitlement')), # lint-amnesty, pylint: disable=line-too-long + ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), # lint-amnesty, pylint: disable=line-too-long + ('support_user', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)), # lint-amnesty, pylint: disable=line-too-long + ('unenrolled_run', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='course_overviews.CourseOverview')), # lint-amnesty, pylint: disable=line-too-long ], options={ 'ordering': ('-history_date', '-history_id'), diff --git a/common/djangoapps/entitlements/migrations/0014_auto_20200115_2022.py b/common/djangoapps/entitlements/migrations/0014_auto_20200115_2022.py index 0a13823b9e..3b322c53a0 100644 --- a/common/djangoapps/entitlements/migrations/0014_auto_20200115_2022.py +++ b/common/djangoapps/entitlements/migrations/0014_auto_20200115_2022.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring # Generated by Django 1.11.27 on 2020-01-15 20:22 @@ -6,7 +6,7 @@ import django.db.models.deletion from django.db import migrations, models -class Migration(migrations.Migration): +class Migration(migrations.Migration): # lint-amnesty, pylint: disable=missing-class-docstring dependencies = [ ('entitlements', '0013_historicalcourseentitlementsupportdetail'), @@ -16,6 +16,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='courseentitlementsupportdetail', name='unenrolled_run', - field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='course_overviews.CourseOverview'), + field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='course_overviews.CourseOverview'), # lint-amnesty, pylint: disable=line-too-long ), ] diff --git a/common/djangoapps/entitlements/migrations/0015_add_unique_together_constraint.py b/common/djangoapps/entitlements/migrations/0015_add_unique_together_constraint.py index 08919e28bd..ad3c4254e1 100644 --- a/common/djangoapps/entitlements/migrations/0015_add_unique_together_constraint.py +++ b/common/djangoapps/entitlements/migrations/0015_add_unique_together_constraint.py @@ -1,11 +1,11 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring # Generated by Django 1.11.27 on 2020-01-29 10:33 from django.db import migrations, models -class Migration(migrations.Migration): +class Migration(migrations.Migration): # lint-amnesty, pylint: disable=missing-class-docstring dependencies = [ ('entitlements', '0014_auto_20200115_2022'), diff --git a/common/djangoapps/entitlements/models.py b/common/djangoapps/entitlements/models.py index 23f3b341cf..25ff1cb9e3 100644 --- a/common/djangoapps/entitlements/models.py +++ b/common/djangoapps/entitlements/models.py @@ -1,4 +1,4 @@ -"""Entitlement Models""" +"""Entitlement Models""" # lint-amnesty, pylint: disable=django-not-configured import logging diff --git a/common/djangoapps/entitlements/rest_api/v1/filters.py b/common/djangoapps/entitlements/rest_api/v1/filters.py index 78e326bf82..c36354d6db 100644 --- a/common/djangoapps/entitlements/rest_api/v1/filters.py +++ b/common/djangoapps/entitlements/rest_api/v1/filters.py @@ -14,7 +14,7 @@ class CharListFilter(filters.CharFilter): if value not in (None, ''): value = value.split(',') - return super(CharListFilter, self).filter(qs, value) + return super(CharListFilter, self).filter(qs, value) # lint-amnesty, pylint: disable=super-with-arguments class UUIDListFilter(CharListFilter): @@ -22,7 +22,7 @@ class UUIDListFilter(CharListFilter): def __init__(self, field_name='uuid', label=None, widget=None, method=None, lookup_expr='in', required=False, distinct=False, exclude=False, **kwargs): - super(UUIDListFilter, self).__init__( + super(UUIDListFilter, self).__init__( # lint-amnesty, pylint: disable=super-with-arguments field_name=field_name, label=label, widget=widget, diff --git a/common/djangoapps/entitlements/rest_api/v1/tests/test_serializers.py b/common/djangoapps/entitlements/rest_api/v1/tests/test_serializers.py index d3ac3e0c3b..61a24a6986 100644 --- a/common/djangoapps/entitlements/rest_api/v1/tests/test_serializers.py +++ b/common/djangoapps/entitlements/rest_api/v1/tests/test_serializers.py @@ -1,4 +1,4 @@ -""" +""" # lint-amnesty, pylint: disable=django-not-configured Tests for the API Serializers. """ diff --git a/common/djangoapps/entitlements/rest_api/v1/tests/test_views.py b/common/djangoapps/entitlements/rest_api/v1/tests/test_views.py index a12aa5b179..d7686ee308 100644 --- a/common/djangoapps/entitlements/rest_api/v1/tests/test_views.py +++ b/common/djangoapps/entitlements/rest_api/v1/tests/test_views.py @@ -33,7 +33,7 @@ log = logging.getLogger(__name__) # Entitlements is not in CMS' INSTALLED_APPS so these imports will error during test collection if settings.ROOT_URLCONF == 'lms.urls': from common.djangoapps.entitlements.tests.factories import CourseEntitlementFactory - from common.djangoapps.entitlements.models import CourseEntitlement, CourseEntitlementPolicy, CourseEntitlementSupportDetail + from common.djangoapps.entitlements.models import CourseEntitlement, CourseEntitlementPolicy, CourseEntitlementSupportDetail # lint-amnesty, pylint: disable=line-too-long from common.djangoapps.entitlements.rest_api.v1.serializers import CourseEntitlementSerializer from common.djangoapps.entitlements.rest_api.v1.views import set_entitlement_policy @@ -46,7 +46,7 @@ class EntitlementViewSetTest(ModuleStoreTestCase): ENTITLEMENTS_DETAILS_PATH = 'entitlements_api:v1:entitlements-detail' def setUp(self): - super(EntitlementViewSetTest, self).setUp() + super(EntitlementViewSetTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.user = UserFactory(is_staff=True) self.client.login(username=self.user.username, password=TEST_PASSWORD) self.course = CourseFactory() @@ -819,7 +819,7 @@ class EntitlementEnrollmentViewSetTest(ModuleStoreTestCase): ENTITLEMENTS_ENROLLMENT_NAMESPACE = 'entitlements_api:v1:enrollments' def setUp(self): - super(EntitlementEnrollmentViewSetTest, self).setUp() + super(EntitlementEnrollmentViewSetTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.user = UserFactory() UserFactory(username=settings.ECOMMERCE_SERVICE_WORKER_USERNAME, is_staff=True) @@ -1103,7 +1103,7 @@ class EntitlementEnrollmentViewSetTest(ModuleStoreTestCase): assert course_entitlement.enrollment_course_run is None assert course_entitlement.expired_at is not None - @patch('common.djangoapps.entitlements.rest_api.v1.views.CourseEntitlement.is_entitlement_refundable', return_value=False) + @patch('common.djangoapps.entitlements.rest_api.v1.views.CourseEntitlement.is_entitlement_refundable', return_value=False) # lint-amnesty, pylint: disable=line-too-long @patch('common.djangoapps.entitlements.models.refund_entitlement', return_value=True) @patch('common.djangoapps.entitlements.rest_api.v1.views.get_course_runs_for_course') def test_user_can_revoke_and_no_refund_available( @@ -1147,7 +1147,7 @@ class EntitlementEnrollmentViewSetTest(ModuleStoreTestCase): assert course_entitlement.enrollment_course_run is not None assert course_entitlement.expired_at is None - @patch('common.djangoapps.entitlements.rest_api.v1.views.CourseEntitlement.is_entitlement_refundable', return_value=True) + @patch('common.djangoapps.entitlements.rest_api.v1.views.CourseEntitlement.is_entitlement_refundable', return_value=True) # lint-amnesty, pylint: disable=line-too-long @patch('common.djangoapps.entitlements.models.refund_entitlement', return_value=False) @patch("common.djangoapps.entitlements.rest_api.v1.views.get_course_runs_for_course") def test_user_is_not_unenrolled_on_failed_refund( diff --git a/common/djangoapps/entitlements/rest_api/v1/views.py b/common/djangoapps/entitlements/rest_api/v1/views.py index 7fb0133e67..c0fa07ea6e 100644 --- a/common/djangoapps/entitlements/rest_api/v1/views.py +++ b/common/djangoapps/entitlements/rest_api/v1/views.py @@ -20,7 +20,7 @@ from common.djangoapps.course_modes.models import CourseMode from common.djangoapps.entitlements.rest_api.v1.filters import CourseEntitlementFilter from common.djangoapps.entitlements.rest_api.v1.permissions import IsAdminOrSupportOrAuthenticatedReadOnly from common.djangoapps.entitlements.rest_api.v1.serializers import CourseEntitlementSerializer -from common.djangoapps.entitlements.models import CourseEntitlement, CourseEntitlementPolicy, CourseEntitlementSupportDetail +from common.djangoapps.entitlements.models import CourseEntitlement, CourseEntitlementPolicy, CourseEntitlementSupportDetail # lint-amnesty, pylint: disable=line-too-long from common.djangoapps.entitlements.utils import is_course_run_entitlement_fulfillable from openedx.core.djangoapps.catalog.utils import get_course_runs_for_course, get_owners_for_course from openedx.core.djangoapps.content.course_overviews.models import CourseOverview @@ -220,7 +220,7 @@ class EntitlementViewSet(viewsets.ModelViewSet): status=status.HTTP_201_CREATED, headers=headers ) - def retrieve(self, request, *args, **kwargs): + def retrieve(self, request, *args, **kwargs): # lint-amnesty, pylint: disable=unused-argument """ Override the retrieve method to expire a record that is past the policy and is requested via the API before returning that record. @@ -230,7 +230,7 @@ class EntitlementViewSet(viewsets.ModelViewSet): serializer = self.get_serializer(entitlement) return Response(serializer.data) - def list(self, request, *args, **kwargs): + def list(self, request, *args, **kwargs): # lint-amnesty, pylint: disable=unused-argument """ Override the list method to expire records that are past the policy and requested via the API before returning those records. @@ -300,7 +300,7 @@ class EntitlementViewSet(viewsets.ModelViewSet): ) CourseEntitlementSupportDetail.objects.create(**support_detail) - return super(EntitlementViewSet, self).partial_update(request, *args, **kwargs) # pylint: disable=no-member + return super(EntitlementViewSet, self).partial_update(request, *args, **kwargs) # lint-amnesty, pylint: disable=no-member, super-with-arguments class EntitlementEnrollmentViewSet(viewsets.GenericViewSet): diff --git a/common/djangoapps/entitlements/signals.py b/common/djangoapps/entitlements/signals.py index 8495e90743..aa0e04cd98 100644 --- a/common/djangoapps/entitlements/signals.py +++ b/common/djangoapps/entitlements/signals.py @@ -1,4 +1,4 @@ -""" +""" # lint-amnesty, pylint: disable=django-not-configured Entitlements related signal handlers. """ diff --git a/common/djangoapps/entitlements/tasks.py b/common/djangoapps/entitlements/tasks.py index 02fbeaf326..b0b5cd00be 100644 --- a/common/djangoapps/entitlements/tasks.py +++ b/common/djangoapps/entitlements/tasks.py @@ -1,11 +1,11 @@ -""" +""" # lint-amnesty, pylint: disable=django-not-configured This file contains celery tasks for entitlements-related functionality. """ from celery import shared_task from celery.utils.log import get_task_logger -from django.conf import settings +from django.conf import settings # lint-amnesty, pylint: disable=unused-import from edx_django_utils.monitoring import set_code_owner_attribute from common.djangoapps.entitlements.models import CourseEntitlement @@ -61,4 +61,4 @@ def expire_old_entitlements(self, start, end, logid='...'): # The call above is idempotent, so retry at will raise self.retry(exc=exc, countdown=countdown, max_retries=MAX_RETRIES) - LOGGER.info('Successfully completed the task expire_old_entitlements after examining %d entries [%s]', entitlements.count(), logid) + LOGGER.info('Successfully completed the task expire_old_entitlements after examining %d entries [%s]', entitlements.count(), logid) # lint-amnesty, pylint: disable=line-too-long diff --git a/common/djangoapps/entitlements/tests/factories.py b/common/djangoapps/entitlements/tests/factories.py index 934a781bf1..52e153c037 100644 --- a/common/djangoapps/entitlements/tests/factories.py +++ b/common/djangoapps/entitlements/tests/factories.py @@ -1,4 +1,4 @@ - +# lint-amnesty, pylint: disable=missing-module-docstring import string from uuid import uuid4 @@ -22,7 +22,7 @@ class CourseEntitlementPolicyFactory(factory.django.DjangoModelFactory): site = factory.SubFactory(SiteFactory) -class CourseEntitlementFactory(factory.django.DjangoModelFactory): +class CourseEntitlementFactory(factory.django.DjangoModelFactory): # lint-amnesty, pylint: disable=missing-class-docstring class Meta(object): model = CourseEntitlement diff --git a/common/djangoapps/entitlements/tests/test_models.py b/common/djangoapps/entitlements/tests/test_models.py index 1c75c1eaea..b206123d88 100644 --- a/common/djangoapps/entitlements/tests/test_models.py +++ b/common/djangoapps/entitlements/tests/test_models.py @@ -33,7 +33,7 @@ class TestCourseEntitlementModelHelpers(ModuleStoreTestCase): Series of tests for the helper methods in the CourseEntitlement Model Class. """ def setUp(self): - super(TestCourseEntitlementModelHelpers, self).setUp() + super(TestCourseEntitlementModelHelpers, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.user = UserFactory() self.client.login(username=self.user.username, password=TEST_PASSWORD) @@ -93,7 +93,7 @@ class TestCourseEntitlementModelHelpers(ModuleStoreTestCase): new_course = CourseFactory() CourseModeFactory( - course_id=new_course.id, + course_id=new_course.id, # lint-amnesty, pylint: disable=no-member mode_slug=CourseMode.VERIFIED, # This must be in the future to ensure it is returned by downstream code. expiration_datetime=now() + timedelta(days=1) @@ -109,7 +109,7 @@ class TestCourseEntitlementModelHelpers(ModuleStoreTestCase): ) assert not CourseEnrollment.is_enrolled(user=self.user, course_key=new_course.id) except AttributeError as error: - self.fail(error.message) + self.fail(error.message) # lint-amnesty, pylint: disable=no-member @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') @@ -117,7 +117,7 @@ class TestModels(TestCase): """Test entitlement with policy model functions.""" def setUp(self): - super(TestModels, self).setUp() + super(TestModels, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.course = CourseOverviewFactory.create( start=now() ) @@ -231,7 +231,7 @@ class TestModels(TestCase): # or the exact same as the original expiration_period_days if somehow no time has passed assert entitlement.get_days_until_expiration() <= entitlement.policy.expiration_period.days - def test_expired_at_datetime(self): + def test_expired_at_datetime(self): # lint-amnesty, pylint: disable=too-many-statements """ Tests that using the getter method properly updates the expired_at field for an entitlement """ diff --git a/common/djangoapps/entitlements/tests/test_tasks.py b/common/djangoapps/entitlements/tests/test_tasks.py index 8a4278cd01..2e3deef834 100644 --- a/common/djangoapps/entitlements/tests/test_tasks.py +++ b/common/djangoapps/entitlements/tests/test_tasks.py @@ -15,7 +15,7 @@ from common.djangoapps.entitlements.tests.factories import CourseEntitlementFact from openedx.core.djangolib.testing.utils import skip_unless_lms -def make_entitlement(expired=False): +def make_entitlement(expired=False): # lint-amnesty, pylint: disable=missing-function-docstring age = CourseEntitlementPolicy.DEFAULT_EXPIRATION_PERIOD_DAYS past_datetime = datetime.now(tz=pytz.UTC) - timedelta(days=age) expired_at = past_datetime if expired else None diff --git a/common/djangoapps/entitlements/tests/test_utils.py b/common/djangoapps/entitlements/tests/test_utils.py index 1bf380a451..a3b51d6be0 100644 --- a/common/djangoapps/entitlements/tests/test_utils.py +++ b/common/djangoapps/entitlements/tests/test_utils.py @@ -12,7 +12,7 @@ from opaque_keys.edx.keys import CourseKey from common.djangoapps.course_modes.models import CourseMode from common.djangoapps.course_modes.tests.factories import CourseModeFactory from openedx.core.djangolib.testing.utils import skip_unless_lms -from common.djangoapps.student.tests.factories import TEST_PASSWORD, CourseEnrollmentFactory, CourseOverviewFactory, UserFactory +from common.djangoapps.student.tests.factories import TEST_PASSWORD, CourseEnrollmentFactory, CourseOverviewFactory, UserFactory # lint-amnesty, pylint: disable=line-too-long from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase # Entitlements is not in CMS' INSTALLED_APPS so these imports will error during test collection @@ -28,12 +28,12 @@ class TestCourseRunFulfillableForEntitlement(ModuleStoreTestCase): """ def setUp(self): - super(TestCourseRunFulfillableForEntitlement, self).setUp() + super(TestCourseRunFulfillableForEntitlement, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.user = UserFactory(is_staff=True) self.client.login(username=self.user.username, password=TEST_PASSWORD) - def create_course( + def create_course( # lint-amnesty, pylint: disable=missing-function-docstring self, start_from_now, end_from_now, diff --git a/common/djangoapps/entitlements/utils.py b/common/djangoapps/entitlements/utils.py index 3d1e5822f5..136a98a625 100644 --- a/common/djangoapps/entitlements/utils.py +++ b/common/djangoapps/entitlements/utils.py @@ -1,4 +1,4 @@ -""" +""" # lint-amnesty, pylint: disable=django-not-configured Utility methods for the entitlement application. """