diff --git a/lti_consumer/lti_xblock.py b/lti_consumer/lti_xblock.py index 3f60d03c3a328e83cb76877eb27efeae6646d18c..86620af6933a85b8954e4faf79e6c141ce72446e 100644 --- a/lti_consumer/lti_xblock.py +++ b/lti_consumer/lti_xblock.py @@ -881,9 +881,7 @@ class LtiConsumerXBlock(StudioEditableXBlockMixin, XBlock): i4x-2-3-lti-31de800015cf4afb973356dbe81496df this part of resource_link_id: makes resource_link_id to be unique among courses inside same system. """ - return str(urllib.parse.quote( - f"{self.runtime.hostname}-{self.location.html_id()}" # pylint: disable=no-member - )) + return str(urllib.parse.quote(f"{settings.LMS_BASE}-{self.location.html_id()}")) # pylint: disable=no-member @property def lis_result_sourcedid(self): diff --git a/lti_consumer/tests/unit/test_lti_xblock.py b/lti_consumer/tests/unit/test_lti_xblock.py index 604f3ab4c5933e3beed54fbb0d6508fb5085b761..2d3561e262fcf0469c7138544af803c04337282f 100644 --- a/lti_consumer/tests/unit/test_lti_xblock.py +++ b/lti_consumer/tests/unit/test_lti_xblock.py @@ -292,13 +292,15 @@ class TestProperties(TestLtiConsumerXBlock): with self.assertRaises(LtiError): __ = self.xblock.external_user_id + @override_settings(LMS_BASE="edx.org") def test_resource_link_id(self): """ Test `resource_link_id` returns appropriate string """ + hostname = "edx.org" self.assertEqual( self.xblock.resource_link_id, - f"{self.xblock.runtime.hostname}-{self.xblock.location.html_id()}" # pylint: disable=no-member + f"{hostname}-{self.xblock.location.html_id()}" # pylint: disable=no-member ) @patch('lti_consumer.lti_xblock.LtiConsumerXBlock.context_id') diff --git a/test_settings.py b/test_settings.py index c1b33d91ab7a9d5a9841f007271224ded214119a..ec88f5730e481a4ec7b001e4b8ed18160a577184 100644 --- a/test_settings.py +++ b/test_settings.py @@ -12,6 +12,7 @@ ROOT_URLCONF = 'test_urls' # LMS Urls - for LTI 1.3 testing LMS_ROOT_URL = "https://example.com" +LMS_BASE = "example.com" # Dummy FEATURES dict FEATURES = {}