goat-book/lists/tests.py

14 lines
513 B
Python

from django.test import TestCase
from django.http import HttpRequest
from lists.views import home_page
# Create your tests here.
class HomePageTest(TestCase):
def test_uses_home_page_template(self):
response = self.client.get("/")
self.assertTemplateUsed(response, "home.html")
def test_can_save_a_POST_request(self):
response = self.client.post("/", data={"item_text": "A new list item"})
self.assertContains(response, "A new list item")
self.assertTemplateUsed(response, "home.html")