'When an attempt is made to retitle an article and another with that
title already exists, there should be form errors'

@pytest.mark.clobber
def test_slug_collision_errors(self):

    self.client.login(username='admin', password='testpass')
    exist_slug = 'existing-doc'
    data = new_document_data()
    data.update({'slug': exist_slug})
    resp = self.client.post(reverse('wiki.create'), data)
    eq_(302, resp.status_code)
    data = new_document_data()
    data.update({'slug': 'some-new-title'})
    resp = self.client.post(reverse('wiki.create'), data)
    eq_(302, resp.status_code)
    data.update({'form-type': 'rev', 'slug': exist_slug})
    resp = self.client.post(reverse('wiki.edit', args=['some-new-title']), data)
    eq_(200, resp.status_code)
    p = pq(resp.content)
    ok_((p.find('.errorlist').length > 0))
    ok_((p.find('.errorlist    a[href="#id_slug"]').length > 0))
