'Raw content should be displayed during a document\'s initial
deferred rendering'

@mock.patch('kuma.wiki.kumascript.get')
def test_raw_content_during_initial_render(self, mock_kumascript_get):

    mock_kumascript_get.return_value = (self.rendered_content, None)
    self.doc.html = self.raw_content
    self.doc.rendered_html = ''
    self.doc.render_started_at = datetime.datetime.now()
    self.doc.save()
    resp = self.client.get(self.url, follow=False)
    p = pq(resp.content)
    txt = p.find('#wikiArticle').text()
    ok_((self.rendered_content not in txt))
    ok_((self.raw_content in txt))
    eq_(0, p.find('#doc-render-raw-fallback').length)
    self.client.login(username='testuser', password='testpass')
    resp = self.client.get(self.url, follow=False)
    p = pq(resp.content)
    eq_(1, p.find('#doc-render-raw-fallback').length)
