added home_page() FBV to apps.lists.views; added HomePageTest() model to .tests; installed django-stubs & related dependencies
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
from django.http import HttpRequest
|
||||
from django.test import TestCase
|
||||
from .views import home_page
|
||||
|
||||
class SmokeTest(TestCase):
|
||||
def test_bad_maths(self):
|
||||
self.assertEqual(1 + 1, 3)
|
||||
class HomePageTest(TestCase):
|
||||
def test_home_page_returns_correct_html(self):
|
||||
request = HttpRequest()
|
||||
response = home_page(request)
|
||||
html = response.content.decode('utf8')
|
||||
self.assertIn('<title>To-Do Lists</title>', html)
|
||||
self.assertTrue(html.startswith('<html>'))
|
||||
self.assertTrue(html.endswith('</html>'))
|
||||
@@ -1,3 +1,4 @@
|
||||
from django.shortcuts import render
|
||||
from django.http import HttpResponse
|
||||
|
||||
# Create your views here.
|
||||
def home_page(request):
|
||||
return HttpResponse('<html><title>To-Do Lists</title></html>')
|
||||
|
||||
Reference in New Issue
Block a user