'\'Save as new\' should raise PermissionDenied for users without the \'add\'
permission.'

def test_change_view_save_as_new(self):

    change_dict_save_as_new = {'_saveasnew': 'Save    as    new', 'title': 'Ikke    ford\xc3\xb8mt', 'content': '<p>edited    article</p>', 'date_0': '2008-03-18', 'date_1': '10:54:39', 'section': self.s1.pk}
    article_change_url = reverse('admin:admin_views_article_change', args=(self.a1.pk,))
    article_count = Article.objects.count()
    self.client.force_login(self.adduser)
    post = self.client.post(article_change_url, change_dict_save_as_new)
    self.assertRedirects(post, self.index_url)
    self.assertEqual(Article.objects.count(), (article_count + 1))
    self.client.logout()
    article_count = Article.objects.count()
    self.client.force_login(self.changeuser)
    post = self.client.post(article_change_url, change_dict_save_as_new)
    self.assertEqual(post.status_code, 403)
    self.assertEqual(Article.objects.count(), article_count)
    article_count = Article.objects.count()
    self.client.force_login(self.superuser)
    post = self.client.post(article_change_url, change_dict_save_as_new)
    self.assertEqual(Article.objects.count(), (article_count + 1))
    new_article = Article.objects.latest('id')
    self.assertRedirects(post, reverse('admin:admin_views_article_change', args=(new_article.pk,)))
