'When a user previews a document with deferred rendering,
we want to force the preview to skip the kumascript POST,
so that big previews can\'t use up too many kumascript connections.
bug 1197971'

@override_config(KUMASCRIPT_TIMEOUT=1.0, KUMASCRIPT_MAX_AGE=600)
@mock.patch('kuma.wiki.kumascript.post')
def test_dont_render_previews_for_deferred_docs(self, mock_post):

    self.doc.defer_rendering = True
    self.doc.save()
    def should_not_post(*args, **kwargs):
        self.fail('Preview    doc    with    deferred    rendering    should    not    post    to    KumaScript.')
    mock_post.side_effect = should_not_post
    self.client.login(username='admin', password='testpass')
    self.client.post(reverse('wiki.preview'), {'doc_id': self.doc.id})
