Skip to content
Snippets Groups Projects
Commit f18e0b88 authored by noraiz-anwar's avatar noraiz-anwar
Browse files

use library summary to fetch metadata

parent e5b9452e
No related merge requests found
......@@ -177,5 +177,5 @@ class LibraryToolsService(object):
"""
return [
(lib.location.library_key.replace(version_guid=None, branch=None), lib.display_name)
for lib in self.store.get_libraries()
for lib in self.store.get_library_summaries()
]
"""
Tests for library tools service.
"""
from mock import patch
from xmodule.library_tools import LibraryToolsService
from xmodule.modulestore.tests.factories import LibraryFactory
from xmodule.modulestore.tests.utils import MixedSplitTestCase
class LibraryToolsServiceTest(MixedSplitTestCase):
"""
Tests for library service.
"""
def setUp(self):
super(LibraryToolsServiceTest, self).setUp()
self.tools = LibraryToolsService(self.store)
def test_list_available_libraries(self):
"""
Test listing of libraries.
"""
_ = LibraryFactory.create(modulestore=self.store)
all_libraries = self.tools.list_available_libraries()
self.assertTrue(all_libraries)
self.assertEqual(len(all_libraries), 1)
@patch('xmodule.modulestore.split_mongo.split.SplitMongoModuleStore.get_library_summaries')
def test_list_available_libraries_fetch(self, mock_get_library_summaries):
"""
Test that library list is compiled using light weight library summary objects.
"""
_ = self.tools.list_available_libraries()
self.assertTrue(mock_get_library_summaries.called)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment