make use of xblock.get_parent()

This commit is contained in:
Tim Babych
2015-01-19 04:04:02 +02:00
parent f8a048d6e2
commit b0c2bc2181
2 changed files with 11 additions and 51 deletions

View File

@@ -142,7 +142,6 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
Setup a dummy course content.
"""
super(EdxNotesHelpersTest, self).setUp()
modulestore().request_cache.data = {}
ClientFactory(name="edx-notes")
self.course = CourseFactory.create()
self.chapter = ItemFactory.create(category="chapter", parent_location=self.course.location)
@@ -577,7 +576,7 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
Tests the result if the unit does not exist.
"""
store = MagicMock()
store.get_parent_location.return_value = None
store.get_item().get_parent.return_value = None
mock_modulestore.return_value = store
mock_has_access.return_value = True
initial_collection = [{
@@ -591,17 +590,6 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
[], helpers.preprocess_collection(self.user, self.course, initial_collection)
)
def test_get_parent_xblock(self):
"""
Tests `get_parent_xblock` method to return parent xblock or None
"""
for _ in range(2):
# repeat the test twice to make sure caching does not interfere
self.assertEqual(helpers.get_parent_xblock(self.html_module_1).location, self.vertical.location)
self.assertEqual(helpers.get_parent_xblock(self.sequential).location, self.chapter.location)
self.assertEqual(helpers.get_parent_xblock(self.chapter).location, self.course.location)
self.assertIsNone(helpers.get_parent_xblock(self.course))
def test_get_parent_unit(self):
"""
Tests `get_parent_unit` method for the successful result.