'Tests multiple sequential attempted valid edits that occur as Ajax POSTs.'

def test_multiple_edits_ajax(self, translate_locale=None):

    self.client.login(username='admin', password='testpass')
    data = new_document_data()
    resp = self.client.post(reverse('wiki.create'), data)
    doc = Document.objects.get(slug=data['slug'])
    if translate_locale:
        posting_url = reverse('wiki.edit', args=[doc.slug], locale=translate_locale)
    else:
        posting_url = reverse('wiki.edit', args=[doc.slug])
    if translate_locale:
        translate_url = (reverse('wiki.translate', args=[data['slug']], locale=settings.WIKI_DEFAULT_LANGUAGE) + '?tolocale={}'.format(translate_locale))
        self.client.post(translate_url, data, follow=True)
        data.update({'locale': translate_locale})
    resp = self.client.get(posting_url)
    page = pq(resp.content)
    rev_id1 = page.find('input[name="current_rev"]').attr('value')
    data.update({'form-type': 'rev', 'content': 'Edit    #1', 'current_rev': rev_id1})
    resp1 = self.client.post(posting_url, data, HTTP_X_REQUESTED_WITH='XMLHttpRequest')
    resp = self.client.get(posting_url)
    page = pq(resp.content)
    rev_id2 = page.find('input[name="current_rev"]').attr('value')
    data.update({'form-type': 'rev', 'content': 'Edit    #2', 'current_rev': rev_id2})
    resp2 = self.client.post(posting_url, data, HTTP_X_REQUESTED_WITH='XMLHttpRequest')
    for resp in [resp1, resp2]:
        eq_(json.loads(resp.content)['error'], False)
        ok_(('error_message' not in json.loads(resp.content).keys()))
