Skip to content

Commit 55f63b4

Browse files
committed
test: update test data to use library_key from ContentLibraryData
1 parent 0817961 commit 55f63b4

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

openedx_authz/tests/api/test_data.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -525,16 +525,15 @@ def test_get_object_success(self, mock_content_library_model):
525525
- Library key matches exactly (canonical validation passes)
526526
"""
527527
library_id = "lib:DemoX:CSPROB"
528-
library_key = LibraryLocatorV2.from_string(library_id)
529528
library_scope = ContentLibraryData(external_key=library_id)
530529
mock_library_obj = Mock()
531-
mock_library_obj.library_key = library_key
530+
mock_library_obj.library_key = library_scope.library_key
532531
mock_content_library_model.objects.get_by_key.return_value = mock_library_obj
533532

534533
result = library_scope.get_object()
535534

536535
self.assertEqual(result, mock_library_obj)
537-
mock_content_library_model.objects.get_by_key.assert_called_once_with(library_key=library_key)
536+
mock_content_library_model.objects.get_by_key.assert_called_once_with(library_scope.library_key)
538537

539538
@patch("openedx_authz.api.data.ContentLibrary")
540539
def test_get_object_does_not_exist(self, mock_content_library_model):
@@ -598,8 +597,7 @@ def test_exists_returns_true_when_library_exists(self, mock_content_library_mode
598597
"""
599598
library_id = "lib:DemoX:CSPROB"
600599
library_scope = ContentLibraryData(external_key=library_id)
601-
library_key = LibraryLocatorV2.from_string(library_id)
602-
mock_content_library_model.objects.get_by_key.return_value = Mock(library_key=library_key)
600+
mock_content_library_model.objects.get_by_key.return_value = Mock(library_key=library_scope.library_key)
603601

604602
result = library_scope.exists()
605603

0 commit comments

Comments
 (0)