'Test automatic adding and removing the new article to/from article_list.'

def test_article_list_update(self):

    c = self.c
    root_data = {u'content': u'[article_list    depth:2]', u'current_revision': str(URLPath.root().article.current_revision.id), u'preview': u'1', u'title': u'Root    Article'}
    response = c.post(resolve_url(u'wiki:edit', path=u''), root_data)
    self.assertRedirects(response, resolve_url(u'wiki:root'))
    response = c.post(resolve_url(u'wiki:create', path=u''), {u'title': u'Sub    Article    1', u'slug': u'SubArticle1'})
    self.assertRedirects(response, resolve_url(u'wiki:get', path=u'subarticle1/'))
    self.assertContains(self.get_by_path(u''), u'Sub    Article    1')
    self.assertContains(self.get_by_path(u''), u'subarticle1/')
    response = c.post(resolve_url(u'wiki:delete', path=u'SubArticle1/'), {u'confirm': u'on', u'purge': u'on', u'revision': str(URLPath.objects.get(slug=u'subarticle1').article.current_revision.id)})
    message = getattr(c.cookies[u'messages'], u'value')
    self.assertRedirects(response, resolve_url(u'wiki:get', path=u''))
    self.assertIn(u'This    article    together    with    all    its    contents    are    now    completely    gone', message)
    self.assertNotContains(self.get_by_path(u''), u'Sub    Article    1')
