'Create a course with assets, copy them all to another course in a different modulestore, and check on it.'

@ddt.data(('mongo', 'split'), ('split', 'mongo'))
@ddt.unpack
def test_copy_all_assets_cross_modulestore(self, from_store, to_store):

    mixed_builder = MIXED_MODULESTORE_BOTH_SETUP
    with mixed_builder.build() as (__, mixed_store):
        with mixed_store.default_store(from_store):
            course1 = CourseFactory.create(modulestore=mixed_store)
        with mixed_store.default_store(to_store):
            course2 = CourseFactory.create(modulestore=mixed_store)
        self.setup_assets(course1.id, None, mixed_store)
        self.assertEquals(len(mixed_store.get_all_asset_metadata(course1.id, 'asset')), 2)
        self.assertEquals(len(mixed_store.get_all_asset_metadata(course2.id, 'asset')), 0)
        mixed_store.copy_all_asset_metadata(course1.id, course2.id, (ModuleStoreEnum.UserID.test * 102))
        all_assets = mixed_store.get_all_asset_metadata(course2.id, 'asset', sort=('displayname', ModuleStoreEnum.SortOrder.ascending))
        self.assertEquals(len(all_assets), 2)
        self.assertEquals(all_assets[0].asset_id.path, 'pic1.jpg')
        self.assertEquals(all_assets[1].asset_id.path, 'shout.ogg')
