-
-
Notifications
You must be signed in to change notification settings - Fork 672
Expand file tree
/
Copy pathtest_views.py
More file actions
25 lines (19 loc) · 822 Bytes
/
test_views.py
File metadata and controls
25 lines (19 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from django.core.management import call_command
from django.test import TestCase
from django.urls import reverse
from apps.blogs.models import BlogEntry, Feed
from apps.blogs.tests.utils import get_test_rss_path
class BlogViewTest(TestCase):
def setUp(self):
self.test_file_path = get_test_rss_path()
def test_blog_home(self):
"""
Test our assignment tag, also ends up testing the update_blogs
management command
"""
Feed.objects.create(id=1, name="psf default", website_url="example.org", feed_url=self.test_file_path)
call_command("update_blogs")
resp = self.client.get(reverse("blog"))
self.assertEqual(resp.status_code, 200)
latest = BlogEntry.objects.latest()
self.assertEqual(resp.context["latest_entry"], latest)