'Tests that an published unit with an unpublished draft remains published across export and re-import.'

@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
def test_changed_published_has_changes_before_export_and_after_import(self, default_ms):

    with self._build_store(default_ms) as (contentstore, source_course_key):
        published_xblock = self.store.create_item(self.user_id, self.course.id, 'vertical', block_id='test_vertical')
        self.store.publish(published_xblock.location, self.user_id)
        self.assertFalse(self._has_changes(published_xblock.location))
        updated_display_name = 'Changed    Display    Name'
        component = self.store.get_item(published_xblock.location)
        component.display_name = updated_display_name
        component = self.store.update_item(component, self.user_id)
        self.assertTrue(self.store.has_changes(component))
        self._export_import_course_round_trip(self.store, contentstore, source_course_key, self.export_dir)
        self.assertTrue(self._has_changes(published_xblock.location))
        with self.store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, source_course_key):
            component = self.store.get_item(published_xblock.location)
            self.assertEqual(component.display_name, updated_display_name)
