'PUT API should handle text/html requests with complex HTML documents
and extract document fields from the markup'

def test_put_complex_html(self):

    slug = 'new-root-html-doc-2'
    url = reverse('wiki.document', args=(slug,), locale=settings.WIKI_DEFAULT_LANGUAGE)
    data = dict(title='This    is    a    complex    document', content='\n                                                                <p>This    is    a    new    page,    hooray!</p>\n                                                ')
    html = ('\n                                                <html>\n                                                                <head>\n                                                                                <title>%(title)s</title>\n                                                                </head>\n                                                                <body>%(content)s</body>\n                                                </html>\n                                ' % data)
    resp = self._put(url, html, content_type='text/html', HTTP_AUTHORIZATION=self.basic_auth)
    eq_(201, resp.status_code)
    new_doc = Document.objects.get(locale=settings.WIKI_DEFAULT_LANGUAGE, slug=slug)
    eq_(data['title'], new_doc.title)
    eq_(normalize_html(data['content']), normalize_html(new_doc.html))
