'Returns the HTML for the xblock when shown within a unit or container page.'

def get_preview_html(self, xblock, view_name):

    preview_url = '/xblock/{usage_key}/{view_name}'.format(usage_key=xblock.location, view_name=view_name)
    resp = self.client.get_json(preview_url)
    self.assertEqual(resp.status_code, 200)
    resp_content = json.loads(resp.content)
    return resp_content['html']
