def test_navigation_feedback_view_with_blog_with_post(self): user = User.objects.create_user('admin', '*****@*****.**', 'admin') user.save() keep_blog1 = create_blog(name="blog1", days=-1, user=user) post = create_post(headline="headline_post_text", text="text", days=-1, blog=keep_blog1, user=user, small_headline="small_head") response = self.client.get(reverse('navigation:feedback')) self.assertContains(response, "blog1", status_code=200)
def test_navigation_about_view_recent_post_with_post(self): user = User.objects.create_user('admin', '*****@*****.**', 'admin') user.save() blog = create_blog(name="blog1", days=-1, user=user) post = create_post(headline="headline", text="text", days=-1, blog=blog, user=user, small_headline="small_head") response = self.client.get(reverse('navigation:about')) self.assertQuerysetEqual( response.context['recent_posts'], ['<Post: headline>'] )
def test_navigation_feedback_view_with_blog(self): user = User.objects.create_user('admin', '*****@*****.**', 'admin') user.save() blog = create_blog(name="blog1", days=-1, user=user) post = create_post(headline="headline", text="text", days=-1, blog=blog, user=user, small_headline="small_head") response = self.client.get(reverse('navigation:feedback')) self.assertContains(response, "blog1", status_code=200) self.assertQuerysetEqual( response.context['blogs'], ['<Blog: blog1>'] )
def test_navigation_keep_view_with_two_blog_with_and_without_post(self): user = User.objects.create_user('admin', '*****@*****.**', 'admin') user.save() keep_blog1 = create_blog(name="blog1", days=-1, user=user) keep_blog2 = create_blog(name="blog2", days=-1, user=user) post = create_post(headline="headline", text="text", days=-1, blog=keep_blog1, user=user, small_headline="small_head") response = self.client.get(reverse('navigation:keep')) self.assertContains(response, "blog1", status_code=200) self.assertQuerysetEqual( response.context['keep_blogs'], ['<Blog: blog1>'] )