On 05/19/2016 04:26 AM, Finucane, Stephen wrote:
+    def test_create(self):
>+        """Ensure creations can be performed by user of patch."""
>+        check = {
>+            'state': 'success',
>+            'target_url': 'http://t.co',
>+            'description': 'description',
>+            'context': 'context',
>+        }
>+
>+        self.client.force_authenticate(user=self.user)
>+        resp = self.client.post(self.urlbase, check)
>+        self.assertEqual(status.HTTP_201_CREATED, resp.status_code)
>+        self.assertEqual(1, Check.objects.all().count())
>+
>+        user = create_user()
>+        self.client.force_authenticate(user=user)
>+        resp = self.client.post(self.urlbase, check)
>+        self.assertEqual(status.HTTP_403_FORBIDDEN, resp.status_code)

You get a 400 "Bad Request" response. I went ahead and added a test to assert this.
_______________________________________________
Patchwork mailing list
[email protected]
https://lists.ozlabs.org/listinfo/patchwork

Reply via email to