'Verifies the content of the two given courses are equal'

def assertCoursesEqual(self, course1_id, course2_id):

    course1_items = self.store.get_items(course1_id)
    course2_items = self.store.get_items(course2_id)
    self.assertGreater(len(course1_items), 0)
    if (len(course1_items) != len(course2_items)):
        course1_block_ids = set([item.location.block_id for item in course1_items])
        course2_block_ids = set([item.location.block_id for item in course2_items])
        raise AssertionError(u'Course1    extra    blocks:    {};    course2    extra    blocks:    {}'.format((course1_block_ids - course2_block_ids), (course2_block_ids - course1_block_ids)))
    for course1_item in course1_items:
        course1_item_loc = course1_item.location
        course2_item_loc = course2_id.make_usage_key(course1_item_loc.block_type, course1_item_loc.block_id)
        if (course1_item_loc.block_type == 'course'):
            store = self.store._get_modulestore_for_courselike(course2_id)
            new_name = ('course' if isinstance(store, SplitMongoModuleStore) else course2_item_loc.run)
            course2_item_loc = course2_item_loc.replace(name=new_name)
        course2_item = self.store.get_item(course2_item_loc)
        self.assertEqual(self.store.has_published_version(course1_item), self.store.has_published_version(course2_item))
        self.assertEqual(hasattr(course1_item, 'data'), hasattr(course2_item, 'data'))
        if hasattr(course1_item, 'data'):
            self.assertEqual(course1_item.data, course2_item.data)
        self.assertEqual(own_metadata(course1_item), own_metadata(course2_item))
        self.assertEqual(course1_item.has_children, course2_item.has_children)
        if course1_item.has_children:
            expected_children = []
            for course1_item_child in course1_item.children:
                expected_children.append(course2_id.make_usage_key(course1_item_child.block_type, course1_item_child.block_id))
            self.assertEqual(expected_children, course2_item.children)
    content_store = self.store.contentstore
    (course1_assets, count_course1_assets) = content_store.get_all_content_for_course(course1_id)
    (_, count_course2_assets) = content_store.get_all_content_for_course(course2_id)
    self.assertEqual(count_course1_assets, count_course2_assets)
    for asset in course1_assets:
        asset_son = asset.get('content_son', asset['_id'])
        self.assertAssetsEqual(asset_son, course1_id, course2_id)
