'Tests that published_on and published_by are set correctly'

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

    self.initdb(default_ms)
    test_course = self.store.create_course('testx', 'GreekHero', 'test_run', self.user_id)
    publish_user = 456
    component = self.store.create_child(self.user_id, test_course.location, 'vertical')
    old_time = datetime.datetime.now(UTC)
    self.store.publish(component.location, publish_user)
    updated_component = self.store.get_item(component.location)
    self.assertLessEqual(old_time, updated_component.published_on)
    self.assertEqual(updated_component.published_by, publish_user)
    updated_component.display_name = 'changed'
    self.store.update_item(updated_component, self.user_id)
    updated_component = self.store.get_item(updated_component.location)
    self.assertLessEqual(old_time, updated_component.published_on)
    self.assertEqual(updated_component.published_by, publish_user)
