16 lines
681 B
Python
16 lines
681 B
Python
from django.test import TestCase
|
|
|
|
class HomePageTest(TestCase):
|
|
def test_uses_home_template(self):
|
|
response = self.client.get('/')
|
|
self.assertTemplateUsed(response, 'apps/dashboard/home.html')
|
|
|
|
def test_renders_input_form(self):
|
|
response = self.client.get('/')
|
|
self.assertContains(response, '<form method="POST">')
|
|
self.assertContains(response, '<input name="item-text"')
|
|
|
|
def test_can_save_a_POST_request(self):
|
|
response = self.client.post('/', data={'item-text': 'A new dashboard item'})
|
|
self.assertContains(response, 'A new dashboard item')
|
|
self.assertTemplateUsed(response, 'apps/dashboard/home.html') |