Skip to content

Commit d9e6e16

Browse files
committed
fix: lint issues
1 parent 1ac9e56 commit d9e6e16

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

cms/djangoapps/contentstore/rest_api/v2/views/tests/test_downstreams.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from organizations.models import Organization
1212

1313
from cms.djangoapps.contentstore.helpers import StaticFileNotices
14-
from cms.lib.xblock.upstream_sync import BadUpstream, UpstreamLink
14+
from cms.lib.xblock.upstream_sync import BadUpstream, ComponentUpstreamSyncManager, UpstreamLink
1515
from cms.djangoapps.contentstore.tests.utils import CourseTestCase
1616
from opaque_keys.edx.keys import UsageKey
1717
from common.djangoapps.student.tests.factories import UserFactory
@@ -235,7 +235,7 @@ def call_api(self, usage_key_string, sync: str | None = None):
235235
content_type="application/json",
236236
)
237237

238-
@patch.object(downstreams_views, "fetch_customizable_fields")
238+
@patch.object(ComponentUpstreamSyncManager, "update_customizable_fields")
239239
@patch.object(downstreams_views, "sync_from_upstream")
240240
@patch.object(UpstreamLink, "get_for_block", _get_upstream_link_good_and_syncable)
241241
def test_200_with_sync(self, mock_sync, mock_fetch):
@@ -250,7 +250,7 @@ def test_200_with_sync(self, mock_sync, mock_fetch):
250250
assert mock_fetch.call_count == 0
251251
assert video_after.upstream == self.video_lib_id
252252

253-
@patch.object(downstreams_views, "fetch_customizable_fields")
253+
@patch.object(ComponentUpstreamSyncManager, "update_customizable_fields")
254254
@patch.object(downstreams_views, "sync_from_upstream")
255255
@patch.object(UpstreamLink, "get_for_block", _get_upstream_link_good_and_syncable)
256256
def test_200_no_sync(self, mock_sync, mock_fetch):
@@ -265,7 +265,11 @@ def test_200_no_sync(self, mock_sync, mock_fetch):
265265
assert mock_fetch.call_count == 1
266266
assert video_after.upstream == self.video_lib_id
267267

268-
@patch.object(downstreams_views, "fetch_customizable_fields", side_effect=BadUpstream(MOCK_UPSTREAM_ERROR))
268+
@patch.object(
269+
ComponentUpstreamSyncManager,
270+
"update_customizable_fields",
271+
side_effect=BadUpstream(MOCK_UPSTREAM_ERROR)
272+
)
269273
def test_400(self, sync: str):
270274
"""
271275
Do we raise a 400 if the provided upstream reference is malformed or not accessible?

openedx/core/djangoapps/xblock/learning_context/learning_context.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ def can_edit_block(self, user: UserType, usage_key: LibraryUsageLocatorV2 | Libr
4040
"""
4141
return False
4242

43-
def can_view_block_for_editing(self, user: UserType, usage_key: LibraryUsageLocatorV2 | LibraryContainerLocator) -> bool:
43+
def can_view_block_for_editing(
44+
self,
45+
user: UserType,
46+
usage_key: LibraryUsageLocatorV2 | LibraryContainerLocator,
47+
) -> bool:
4448
"""
4549
Assuming a block with the specified ID (usage_key) exists, does the
4650
specified user have permission to view its fields and OLX details (but

openedx/core/djangoapps/xblock/learning_context/manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def get_learning_context_impl(key):
3535
"""
3636
if isinstance(key, LearningContextKey):
3737
context_type = key.CANONICAL_NAMESPACE # e.g. 'lib'
38-
elif isinstance(key, UsageKeyV2) or isinstance(key, LibraryItemKey):
38+
elif isinstance(key, (UsageKeyV2, LibraryItemKey)):
3939
context_type = key.context_key.CANONICAL_NAMESPACE
4040
elif isinstance(key, OpaqueKey):
4141
# Maybe this is an older modulestore key etc.

openedx/core/djangoapps/xblock/runtime/learning_core_runtime.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ class LearningCoreXBlockRuntime(XBlockRuntime):
167167
"""
168168

169169
def _initialize_block(self, content, usage_key, block_type, version: int | LatestVersion):
170+
"""
171+
Creates new xblock from given content, usage_key and block_type
172+
"""
170173
xml_node = etree.fromstring(content)
171174
keys = ScopeIds(self.user_id, block_type, None, usage_key)
172175

0 commit comments

Comments
 (0)