Skip to content

Commit 3c02a43

Browse files
committed
fix: quality
1 parent 4ab9eb7 commit 3c02a43

10 files changed

Lines changed: 50 additions & 30 deletions

File tree

openedx/core/djangoapps/agreements/admin.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
"""
44

55
from django.contrib import admin
6-
from openedx.core.djangoapps.agreements.models import IntegritySignature, UserAgreement
7-
from openedx.core.djangoapps.agreements.models import LTIPIITool
8-
from openedx.core.djangoapps.agreements.models import LTIPIISignature
9-
from openedx.core.djangoapps.agreements.models import ProctoringPIISignature
6+
7+
from openedx.core.djangoapps.agreements.models import (
8+
IntegritySignature,
9+
LTIPIISignature,
10+
LTIPIITool,
11+
ProctoringPIISignature,
12+
UserAgreement
13+
)
1014

1115

1216
class IntegritySignatureAdmin(admin.ModelAdmin):

openedx/core/djangoapps/agreements/api.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,17 @@
1010
from django.core.exceptions import ObjectDoesNotExist
1111
from opaque_keys.edx.keys import CourseKey
1212

13-
from .data import LTIPIISignatureData, LTIToolsReceivingPIIData, UserAgreementRecordData
14-
from .models import IntegritySignature, LTIPIISignature, LTIPIITool, UserAgreementRecord
13+
from openedx.core.djangoapps.agreements.data import (
14+
LTIPIISignatureData,
15+
LTIToolsReceivingPIIData,
16+
UserAgreementRecordData
17+
)
18+
from openedx.core.djangoapps.agreements.models import (
19+
IntegritySignature,
20+
LTIPIISignature,
21+
LTIPIITool,
22+
UserAgreementRecord
23+
)
1524

1625
log = logging.getLogger(__name__)
1726
User = get_user_model()

openedx/core/djangoapps/agreements/data.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import attr
88

9-
from .models import UserAgreementRecord, UserAgreement
9+
from openedx.core.djangoapps.agreements.models import UserAgreement, UserAgreementRecord
1010

1111

1212
@attr.s(frozen=True, auto_attribs=True)
@@ -28,7 +28,6 @@ class LTIPIISignatureData:
2828
lti_tools_hash: str
2929

3030

31-
3231
@dataclass
3332
class UserAgreementData:
3433
"""
@@ -37,8 +36,8 @@ class UserAgreementData:
3736
type: str
3837
name: str
3938
summary: str
40-
text: str|None
41-
url: str|None
39+
text: str | None
40+
url: str | None
4241

4342
@classmethod
4443
def from_model(cls, model: UserAgreement):
@@ -50,6 +49,7 @@ def from_model(cls, model: UserAgreement):
5049
url=model.url
5150
)
5251

52+
5353
@dataclass
5454
class UserAgreementRecordData:
5555
"""

openedx/core/djangoapps/agreements/serializers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
"""
44
from rest_framework import serializers
55

6+
from openedx.core.djangoapps.agreements.models import IntegritySignature, LTIPIISignature
67
from openedx.core.lib.api.serializers import CourseKeyField
78

8-
from .models import IntegritySignature, LTIPIISignature
9-
109

1110
class IntegritySignatureSerializer(serializers.ModelSerializer):
1211
"""

openedx/core/djangoapps/agreements/tests/test_api.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,21 @@
99
from testfixtures import LogCapture
1010

1111
from common.djangoapps.student.tests.factories import UserFactory
12-
from openedx.core.djangolib.testing.utils import skip_unless_lms
13-
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
14-
from xmodule.modulestore.tests.factories import CourseFactory
15-
16-
from ..api import (
12+
from openedx.core.djangoapps.agreements.api import (
1713
create_integrity_signature,
1814
create_lti_pii_signature,
1915
create_user_agreement_record,
2016
get_integrity_signature,
2117
get_integrity_signatures_for_course,
18+
get_latest_user_agreement_record,
2219
get_lti_pii_signature,
2320
get_pii_receiving_lti_tools,
24-
get_latest_user_agreement_record,
2521
get_user_agreement_records
2622
)
27-
from ..models import LTIPIITool
23+
from openedx.core.djangoapps.agreements.models import LTIPIITool
24+
from openedx.core.djangolib.testing.utils import skip_unless_lms
25+
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
26+
from xmodule.modulestore.tests.factories import CourseFactory
2827

2928
LOGGER_NAME = "openedx.core.djangoapps.agreements.api"
3029

openedx/core/djangoapps/agreements/tests/test_models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from django.db import IntegrityError
66
from django.test import TestCase
7+
78
from openedx.core.djangoapps.agreements.models import UserAgreement
89

910

openedx/core/djangoapps/agreements/tests/test_views.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@
1414

1515
from common.djangoapps.student.roles import CourseStaffRole
1616
from common.djangoapps.student.tests.factories import AdminFactory, UserFactory
17-
from openedx.core.djangolib.testing.utils import skip_unless_lms
18-
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
19-
from xmodule.modulestore.tests.factories import CourseFactory
20-
21-
from ..api import (
17+
from openedx.core.djangoapps.agreements.api import (
2218
create_integrity_signature,
2319
create_user_agreement_record,
2420
get_integrity_signatures_for_course,
2521
get_lti_pii_signature
2622
)
23+
from openedx.core.djangolib.testing.utils import skip_unless_lms
24+
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
25+
from xmodule.modulestore.tests.factories import CourseFactory
2726

2827

2928
@skip_unless_lms

openedx/core/djangoapps/agreements/toggles.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44

55
from opaque_keys.edx.keys import CourseKey
6+
67
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag
78

89
# .. toggle_name: agreements.enable_lti_pii_acknowledgement

openedx/core/djangoapps/agreements/urls.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
from django.urls import path, re_path
77
from rest_framework.routers import DefaultRouter
88

9-
from .views import IntegritySignatureView, LTIPIISignatureView, UserAgreementRecordsView, UserAgreementsViewSet
9+
from openedx.core.djangoapps.agreements.views import (
10+
IntegritySignatureView,
11+
LTIPIISignatureView,
12+
UserAgreementRecordsView,
13+
UserAgreementsViewSet
14+
)
1015

1116
router = DefaultRouter()
1217
router.register(r'agreement', UserAgreementsViewSet, basename='user_agreements')

openedx/core/djangoapps/agreements/views.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,21 @@
1414

1515
from common.djangoapps.student import auth
1616
from common.djangoapps.student.roles import CourseStaffRole
17-
18-
from .api import (
17+
from openedx.core.djangoapps.agreements.api import (
1918
create_integrity_signature,
2019
create_lti_pii_signature,
2120
create_user_agreement_record,
2221
get_integrity_signature,
2322
get_latest_user_agreement_record
2423
)
25-
from .models import UserAgreement
26-
from .serializers import IntegritySignatureSerializer, LTIPIISignatureSerializer, UserAgreementRecordSerializer, \
24+
from openedx.core.djangoapps.agreements.models import UserAgreement
25+
from openedx.core.djangoapps.agreements.serializers import (
26+
IntegritySignatureSerializer,
27+
LTIPIISignatureSerializer,
28+
UserAgreementRecordSerializer,
2729
UserAgreementSerializer
28-
from ...lib.api.view_utils import view_auth_classes
30+
)
31+
from openedx.core.lib.api.view_utils import view_auth_classes
2932

3033

3134
def is_user_course_or_global_staff(user, course_id):

0 commit comments

Comments
 (0)