'Test republishing an item.'

def test_republish(self):

    new_display_name = 'New    Display    Name'
    self.assertFalse(self._is_location_published(self.problem_usage_key))
    self.client.ajax_post(self.problem_update_url, data={'publish': 'republish', 'metadata': {'display_name': new_display_name}})
    self.assertFalse(self._is_location_published(self.problem_usage_key))
    draft = self.get_item_from_modulestore(self.problem_usage_key, verify_is_draft=True)
    self.assertEqual(draft.display_name, new_display_name)
    self.client.ajax_post(self.problem_update_url, data={'publish': 'make_public'})
    new_display_name_2 = 'New    Display    Name    2'
    self.client.ajax_post(self.problem_update_url, data={'publish': 'republish', 'metadata': {'display_name': new_display_name_2}})
    self._verify_published_with_no_draft(self.problem_usage_key)
    published = modulestore().get_item(self.problem_usage_key, revision=ModuleStoreEnum.RevisionOption.published_only)
    self.assertEqual(published.display_name, new_display_name_2)
