Merge pull request #17287 from edx/mroytman/assets-api-zero-assets
mroytman/assets api zero assets
This commit is contained in:
@@ -145,7 +145,7 @@ def _assets_json(request, course_key):
|
||||
|
||||
assets, total_count = _get_assets_for_page(course_key, query_options)
|
||||
|
||||
if request_options['requested_page'] > 0 and first_asset_to_display_index >= total_count:
|
||||
if request_options['requested_page'] > 0 and first_asset_to_display_index >= total_count and total_count > 0:
|
||||
_update_options_to_requery_final_page(query_options, total_count)
|
||||
current_page = query_options['current_page']
|
||||
first_asset_to_display_index = _get_first_asset_index(current_page, requested_page_size)
|
||||
|
||||
@@ -201,6 +201,10 @@ class PaginationTestCase(AssetsTestCase):
|
||||
self.url + "?page_size=2&page=2", 2, 2, 4)
|
||||
self.assert_correct_asset_response(
|
||||
self.url + "?page_size=3&page=1", 3, 1, 4)
|
||||
self.assert_correct_asset_response(
|
||||
self.url + "?page_size=1&page=5&asset_type=OTHER", 0, 1, 1)
|
||||
self.assert_correct_asset_response(
|
||||
self.url + "?page_size=1&page=5&asset_type=Images", 5, 0, 0)
|
||||
|
||||
@mock.patch('xmodule.contentstore.mongo.MongoContentStore.get_all_content_for_course')
|
||||
def test_mocked_filtered_response(self, mock_get_all_content_for_course):
|
||||
|
||||
Reference in New Issue
Block a user