@@ -0,0 +1,2298 @@
+import datetime%0A%0Afrom django.test import TestCase%0Afrom django.urls import reverse%0Afrom django.contrib.auth.models import User%0A%0Afrom ..models import Post%0A%0A%0Aclass BlogViewTests(TestCase):%0A    def test_blog(self):%0A        new_user = User.objects.create(%0A            username = 'tester',%0A            password = 'qwe123!@#',%0A        )%0A        new_post = Post.objects.create(%0A            date = datetime.datetime.now(),%0A            title = 'New post title',%0A            slug = 'new-post-slug',%0A            author = new_user,%0A            teaser = 'Teaser text',%0A            body = 'Post body, lots of words',%0A        )%0A        url = reverse('main:blog')%0A        response = self.client.get(url)%0A        self.assertContains(response, 'OK!Thess')%0A        self.assertContains(response, new_post.title)%0A        self.assertContains(response, new_post.slug)%0A        self.assertContains(response, new_post.teaser)%0A%0A    def test_blog_post(self):%0A        new_user = User.objects.create(%0A            username = 'tester',%0A            password = 'qwe123!@#',%0A        )%0A        new_post = Post.objects.create(%0A            date = datetime.datetime.now(),%0A            title = 'New post title',%0A            slug = 'new-post-slug',%0A            author = new_user,%0A            teaser = 'Teaser text',%0A            body = 'Post body, lots of words',%0A        )%0A        url = reverse('main:blog_post', args=%5Bnew_post.slug%5D)%0A        response = self.client.get(url)%0A        self.assertContains(response, 'OK!Thess')%0A        self.assertContains(response, new_post.title)%0A        self.assertContains(response, new_post.body)%0A%0A    def test_featured_blog_post(self):%0A        new_user = User.objects.create(%0A            username = 'tester',%0A            password = 'qwe123!@#',%0A        )%0A        new_post = Post.objects.create(%0A            date = datetime.datetime.now(),%0A            title = 'New post title',%0A            slug = 'new-post-slug',%0A            author = new_user,%0A            teaser = 'Teaser text',%0A            body = 'Post body, lots of words',%0A            is_featured = True,%0A        )%0A        url = reverse('main:index')%0A        response = self.client.get(url)%0A        self.assertContains(response, 'OK!Thess')%0A        self.assertContains(response, new_post.title)%0A        self.assertContains(response, new_post.teaser)%0A

add blog tests