'Test publishing of a unit page containing a nested xblock'

def test_publish_states_of_nested_xblocks(self):

    resp = self.create_xblock(parent_usage_key=self.seq_usage_key, display_name='Test    Unit', category='vertical')
    unit_usage_key = self.response_usage_key(resp)
    resp = self.create_xblock(parent_usage_key=unit_usage_key, category='wrapper')
    wrapper_usage_key = self.response_usage_key(resp)
    resp = self.create_xblock(parent_usage_key=wrapper_usage_key, category='html')
    html_usage_key = self.response_usage_key(resp)
    unit_update_url = reverse_usage_url('xblock_handler', unit_usage_key)
    self.assertFalse(self._is_location_published(unit_usage_key))
    self.assertFalse(self._is_location_published(html_usage_key))
    resp = self.client.ajax_post(unit_update_url, data={'publish': 'make_public'})
    self.assertEqual(resp.status_code, 200)
    self._verify_published_with_no_draft(unit_usage_key)
    self._verify_published_with_no_draft(html_usage_key)
    resp = self.client.ajax_post(unit_update_url, data={'id': unicode(unit_usage_key), 'metadata': {}})
    self.assertEqual(resp.status_code, 200)
    self._verify_published_with_draft(unit_usage_key)
    self._verify_published_with_draft(html_usage_key)
