Skip to content

Commit

Permalink
Using display_name_with_default instead of display_name.
Browse files Browse the repository at this point in the history
TNL-4103
  • Loading branch information
muzaffaryousaf committed Feb 16, 2016
1 parent 8280e22 commit 67a88b0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/bookmarks/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _calculate_course_xblocks_data(course_key):
usage_id = unicode(current_block.scope_ids.usage_id)
block_info = {
'usage_key': current_block.scope_ids.usage_id,
'display_name': current_block.display_name,
'display_name': current_block.display_name_with_default,
'children_ids': [unicode(child.scope_ids.usage_id) for child in children]
}
blocks_info_dict[usage_id] = block_info
Expand Down
18 changes: 17 additions & 1 deletion openedx/core/djangoapps/bookmarks/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import ddt

from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.factories import check_mongo_calls
from xmodule.modulestore.tests.factories import check_mongo_calls, ItemFactory

from ..models import XBlockCache
from ..tasks import _calculate_course_xblocks_data, _update_xblocks_cache
Expand Down Expand Up @@ -164,3 +164,19 @@ def test_update_xblocks_cache(self, course_attr, expected_sql_queries):

with self.assertNumQueries(3):
_update_xblocks_cache(course.id)

def test_update_xblocks_cache_with_display_name_none(self):
"""
Test that the xblocks data is persisted correctly with display_name=None.
"""
ItemFactory.create(parent_location=self.sequential_2.location, category='vertical', display_name=None)

_update_xblocks_cache(self.course.id)

for usage_key, __ in self.course_expected_cache_data.items():
xblock_cache = XBlockCache.objects.get(usage_key=usage_key)
for path_index, path in enumerate(xblock_cache.paths):
for path_item_index, path_item in enumerate(path):
self.assertEqual(
path_item.usage_key, self.course_expected_cache_data[usage_key][path_index][path_item_index + 1]
)

0 comments on commit 67a88b0

Please sign in to comment.