'Test the has_published_version method'

@ddt.data((ModuleStoreEnum.Type.mongo, 1, 0), (ModuleStoreEnum.Type.split, 2, 0))
@ddt.unpack
def test_has_published_version(self, default_ms, max_find, max_send):

    self.initdb(default_ms)
    self._create_block_hierarchy()
    item = self.store.create_child(self.user_id, self.writable_chapter_location, 'problem', 'test_compute_publish_state')
    item_location = item.location
    with check_mongo_calls(max_find, max_send):
        self.assertFalse(self.store.has_published_version(item))
    self.store.publish(item_location, self.user_id)
    item = self.store.get_item(item_location)
    self.assertTrue(self.store.has_published_version(item))
    self.store.unpublish(item_location, self.user_id)
    item = self.store.get_item(item_location)
    self.assertFalse(self.store.has_published_version(item))
    self.store.publish(item_location, self.user_id)
    item = self.store.get_item(item_location)
    self.assertTrue(self.store.has_published_version(item))
    self.store.convert_to_draft(item_location, self.user_id)
    item = self.store.get_item(item_location)
    self.assertTrue(self.store.has_published_version(item))
    item.display_name = 'new    name'
    item = self.store.update_item(item, self.user_id)
    self.assertTrue(self.store.has_changes(item))
    self.assertTrue(self.store.has_published_version(item))
