Skip to content

Commit 45ce7ac

Browse files
committed
fix: lint issues
1 parent f9cb60e commit 45ce7ac

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

lti_consumer/admin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717

1818
class LtiConfigurationInline(admin.TabularInline):
19+
"""
20+
Inline for the LtiConfiguration models in Lti1p3Passport.
21+
"""
1922
model = LtiConfiguration
2023
extra = 0
2124
can_delete = False

lti_consumer/api.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,15 @@ def get_or_create_local_lti_config(lti_version, block, config_store=LtiConfigura
4949
passport.lti_1p3_tool_keyset_url = str(block.lti_1p3_tool_keyset_url)
5050
passport.save()
5151
elif (
52-
passport.lti_1p3_tool_public_key != str(block.lti_1p3_tool_public_key)
53-
or passport.lti_1p3_tool_keyset_url != str(block.lti_1p3_tool_keyset_url)
52+
passport.lti_1p3_tool_public_key != str(block.lti_1p3_tool_public_key) or
53+
passport.lti_1p3_tool_keyset_url != str(block.lti_1p3_tool_keyset_url)
5454
):
5555
# tool public key or url has changed, we create a new passport to avoid conflicts
5656
# with the existing configuration
5757
passport = Lti1p3Passport.objects.create(
5858
lti_1p3_tool_public_key=str(block.lti_1p3_tool_public_key),
5959
lti_1p3_tool_keyset_url=str(block.lti_1p3_tool_keyset_url),
6060
)
61-
from lti_consumer.plugin.compat import save_xblock # pylint: disable=import-outside-toplevel
6261
block.lti_1p3_passport_id = str(passport.passport_id)
6362
block.save()
6463
save_xblock(block)

lti_consumer/lti_1p3/key_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def validate_and_decode(self, token):
112112
message = jwt.decode(
113113
token,
114114
key,
115-
algorithms=['RS256', 'RS512',],
115+
algorithms=['RS256', 'RS512'],
116116
options={
117117
'verify_signature': True,
118118
'verify_aud': False

lti_consumer/lti_xblock.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,16 @@
5555
import urllib.parse
5656
from collections import namedtuple
5757
from importlib import import_module
58-
import uuid
5958

6059
import bleach
6160
from django.conf import settings
6261
from django.utils import timezone
6362
from web_fragments.fragment import Fragment
64-
6563
from webob import Response
6664
from xblock.core import List, Scope, String, XBlock
6765
from xblock.fields import Boolean, Float, Integer
6866
from xblock.validation import ValidationMessage
67+
6968
try:
7069
from xblock.utils.resources import ResourceLoader
7170
from xblock.utils.studio_editable import StudioEditableXBlockMixin

lti_consumer/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def clean(self):
155155
raise ValidationError({
156156
"config_store": _(
157157
"LTI Configuration stored on the model for LTI 1.3 must have a value for one of "
158-
"lti_1p3_tool_public_key or lti_1p3_tool_keyset_url."
158+
"lti_1p3_tool_public_key or lti_1p3_tool_keyset_url."
159159
),
160160
})
161161

lti_consumer/tests/unit/test_api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
"""
44
from unittest.mock import Mock, patch
55
from urllib.parse import parse_qs, urlparse
6-
import ddt
76

7+
import ddt
88
from Cryptodome.PublicKey import RSA
99
from django.test.testcases import TestCase
1010
from edx_django_utils.cache import get_cache_key
1111

1212
from lti_consumer.api import (
1313
_get_config_by_config_id,
14-
get_or_create_local_lti_config,
1514
config_id_for_block,
15+
get_deep_linking_data,
1616
get_end_assessment_return,
1717
get_lti_1p3_content_url,
18-
get_deep_linking_data,
1918
get_lti_1p3_launch_info,
2019
get_lti_1p3_launch_start_url,
20+
get_or_create_local_lti_config,
2121
validate_lti_1p3_launch_data,
2222
)
2323
from lti_consumer.data import Lti1p3LaunchData, Lti1p3ProctoringLaunchData
@@ -129,7 +129,7 @@ def test_store_types(self, mapping_pair, mock_external_config):
129129

130130

131131
@ddt.ddt
132-
class TestGetOrCreateLocalLtiConfiguration(TestCase):
132+
class TestGetOrCreateLocalLtiConfiguration(Lti1P3TestCase):
133133
"""
134134
Unit tests for _get_or_create_local_lti_config API method.
135135
"""
@@ -146,7 +146,7 @@ def test_create_lti_config_if_inexistent(self):
146146
# Call API
147147
lti_config = get_or_create_local_lti_config(
148148
lti_version=lti_version,
149-
block_location=location
149+
block=self.xblock
150150
)
151151

152152
# Check if the object was created

0 commit comments

Comments
 (0)