'Delete view should restrict access and actually delete items.'

def testDeleteView(self):

    delete_dict = {'post': 'yes'}
    self.client.get('/test_admin/admin/')
    self.client.post('/test_admin/admin/', self.adduser_login)
    request = self.client.get('/test_admin/admin/admin_views/article/1/delete/')
    self.assertEqual(request.status_code, 403)
    post = self.client.post('/test_admin/admin/admin_views/article/1/delete/', delete_dict)
    self.assertEqual(post.status_code, 403)
    self.assertEqual(Article.objects.all().count(), 3)
    self.client.get('/test_admin/admin/logout/')
    self.client.get('/test_admin/admin/')
    self.client.post('/test_admin/admin/', self.deleteuser_login)
    response = self.client.get('/test_admin/admin/admin_views/section/1/delete/')
    self.assertContains(response, 'admin_views/article/1/')
    response = self.client.get('/test_admin/admin/admin_views/article/1/delete/')
    self.assertEqual(response.status_code, 200)
    post = self.client.post('/test_admin/admin/admin_views/article/1/delete/', delete_dict)
    self.assertRedirects(post, '/test_admin/admin/')
    self.assertEqual(Article.objects.all().count(), 2)
    self.assertEqual(len(mail.outbox), 1)
    self.assertEqual(mail.outbox[0].subject, 'Greetings    from    a    deleted    object')
    article_ct = ContentType.objects.get_for_model(Article)
    logged = LogEntry.objects.get(content_type=article_ct, action_flag=DELETION)
    self.assertEqual(logged.object_id, u'1')
    self.client.get('/test_admin/admin/logout/')
