Ejemplo n.º 1
0
 def test_manager_can_delete(self):
     self.login()
     path = PathFactory()
     response = self.client.get(path.get_detail_url())
     self.assertEqual(response.status_code, 200)
     response = self.client.post(path.get_delete_url())
     self.assertEqual(response.status_code, 302)
Ejemplo n.º 2
0
 def test_manager_can_delete(self):
     self.login()
     path = PathFactory()
     response = self.client.get(path.get_detail_url())
     self.assertEqual(response.status_code, 200)
     response = self.client.post(path.get_delete_url())
     self.assertEqual(response.status_code, 302)
Ejemplo n.º 3
0
    def test_list_attachments_in_details(self):
        """Test that the list is correctly displayed on the detail page of path"""

        path = PathFactory(length=1)
        AttachmentFactory(obj=path, creator=self.user)

        response = self.client.get(path.get_detail_url())

        self.assertTemplateUsed(response, template_name="paperclip/details.html")
        self.assertItemsEqual(Attachment.objects.attachments_for_object(path), response.context["attachments_list"])
Ejemplo n.º 4
0
    def test_list_attachments_in_details(self):
        """Test that the list is correctly displayed on the detail page of path"""

        path = PathFactory(length=1)
        AttachmentFactory(obj=path, creator=self.user)

        response = self.client.get(path.get_detail_url())

        self.assertTemplateUsed(response,
                                template_name='paperclip/details.html')
        self.assertItemsEqual(
            Attachment.objects.attachments_for_object(path),
            response.context['attachments_list'],
        )