Skip to content

Commit

Permalink
fix: Missing external configuration error message
Browse files Browse the repository at this point in the history
  • Loading branch information
kuipumu committed Oct 25, 2023
1 parent f36725a commit 291567b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lti_consumer/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from opaque_keys.edx.keys import CourseKey

from lti_consumer.exceptions import ExternalConfigurationNotFound
from lti_consumer.lti_1p3.constants import LTI_1P3_ROLE_MAP
from .models import CourseAllowPIISharingInLTIFlag, LtiConfiguration, LtiDlContentItem
from .utils import (
Expand Down Expand Up @@ -69,10 +70,13 @@ def _get_lti_config_for_block(block):
LtiConfiguration.CONFIG_ON_DB,
)
elif block.config_type == 'external':
config = get_external_config_from_filter(
{"course_key": block.scope_ids.usage_id.context_key},
block.external_config
)
config = get_external_config_from_filter({}, block.external_config)

if not config:
raise ExternalConfigurationNotFound(

Check warning on line 76 in lti_consumer/api.py

View check run for this annotation

Codecov / codecov/patch

lti_consumer/api.py#L76

Added line #L76 was not covered by tests
f"External LTI configuration with ID {block.external_config}, not found.",
)

lti_config = _get_or_create_local_lti_config(
config.get("version"),
block.scope_ids.usage_id,
Expand Down

0 comments on commit 291567b

Please sign in to comment.