'Save multiple metadata in each store and retrieve it singularly, as all assets, and after deleting all.'

@ddt.data(*MODULESTORE_SETUPS)
def test_get_all_assets_with_paging(self, storebuilder):

    with storebuilder.build() as (__, store):
        course1 = CourseFactory.create(modulestore=store)
        course2 = CourseFactory.create(modulestore=store)
        self.setup_assets(course1.id, course2.id, store)
        expected_sorts_by_2 = ((('displayname', ModuleStoreEnum.SortOrder.ascending), ('code.tgz', 'demo.swf', 'dog.png', 'roman_history.pdf', 'weather_patterns.bmp'), (2, 2, 1)), (('displayname', ModuleStoreEnum.SortOrder.descending), ('weather_patterns.bmp', 'roman_history.pdf', 'dog.png', 'demo.swf', 'code.tgz'), (2, 2, 1)), (('uploadDate', ModuleStoreEnum.SortOrder.ascending), ('code.tgz', 'dog.png', 'roman_history.pdf', 'weather_patterns.bmp', 'demo.swf'), (2, 2, 1)), (('uploadDate', ModuleStoreEnum.SortOrder.descending), ('demo.swf', 'weather_patterns.bmp', 'roman_history.pdf', 'dog.png', 'code.tgz'), (2, 2, 1)))
        for sort_test in expected_sorts_by_2:
            for i in xrange(3):
                asset_page = store.get_all_asset_metadata(course2.id, 'asset', start=(2 * i), maxresults=2, sort=sort_test[0])
                num_expected_results = sort_test[2][i]
                expected_filename = sort_test[1][(2 * i)]
                self.assertEquals(len(asset_page), num_expected_results)
                self.assertEquals(asset_page[0].asset_id.path, expected_filename)
                if (num_expected_results == 2):
                    expected_filename = sort_test[1][((2 * i) + 1)]
                    self.assertEquals(asset_page[1].asset_id.path, expected_filename)
        asset_page = store.get_all_asset_metadata(course2.id, 'asset', start=0, sort=('displayname', ModuleStoreEnum.SortOrder.ascending))
        self.assertEquals(len(asset_page), 5)
        self.assertEquals(asset_page[0].asset_id.path, 'code.tgz')
        self.assertEquals(asset_page[1].asset_id.path, 'demo.swf')
        self.assertEquals(asset_page[2].asset_id.path, 'dog.png')
        self.assertEquals(asset_page[3].asset_id.path, 'roman_history.pdf')
        self.assertEquals(asset_page[4].asset_id.path, 'weather_patterns.bmp')
        asset_page = store.get_all_asset_metadata(course2.id, 'asset', start=100, sort=('uploadDate', ModuleStoreEnum.SortOrder.ascending))
        self.assertEquals(len(asset_page), 0)
        asset_page = store.get_all_asset_metadata(course2.id, 'asset', start=3, maxresults=0, sort=('displayname', ModuleStoreEnum.SortOrder.ascending))
        self.assertEquals(len(asset_page), 0)
        asset_page = store.get_all_asset_metadata(course2.id, 'asset', start=3, maxresults=(-12345), sort=('displayname', ModuleStoreEnum.SortOrder.descending))
        self.assertEquals(len(asset_page), 2)
