diff --git a/flangr/posts/tests.py b/flangr/posts/tests.py index 57b981f..6ec3171 100644 --- a/flangr/posts/tests.py +++ b/flangr/posts/tests.py @@ -106,3 +106,15 @@ class PostViewsTests(TestCase): url = reverse("posts:post_detail", kwargs={"pk": self.post.pk}) c.post(url, {"comment": ""}) self.assertFalse(self.post.comments.all().exists()) + + def test_can_post_a_post(self): + c = Client() + c.login(username="someone", password="secret") + url = reverse("posts:post_create") + with open( + os.path.join(os.path.dirname(__file__), "test_data", "test_img.png"), + mode="rb", + ) as f: + c.post(url, {"title": "title", "body": "body", "img": File(f)}) + + self.assertEqual(Post.objects.count(), 2)