VelogaWhite commited on
Commit
02c72d1
·
1 Parent(s): bb76786

url config, map / to home_page view

Browse files
Files changed (2) hide show
  1. lists/tests.py +4 -6
  2. superlists/urls.py +4 -4
lists/tests.py CHANGED
@@ -5,9 +5,7 @@ from lists.views import home_page
5
 
6
  class HomePageTest(TestCase):
7
  def test_home_page_returns_correct_html(self):
8
- request = HttpRequest()
9
- response = home_page(request)
10
- html = response.content.decode("utf8")
11
- self.assertIn("<title>To-Do lists</title>", html)
12
- self.assertTrue(html.startswith("<html>"))
13
- self.assertTrue(html.endswith("</html>"))
 
5
 
6
  class HomePageTest(TestCase):
7
  def test_home_page_returns_correct_html(self):
8
+ response = self.client.get("/")
9
+ self.assertContains(response, "<title>To-Do lists</title>")
10
+ self.assertContains(response, "<html>")
11
+ self.assertContains(response, "</html>")
 
 
superlists/urls.py CHANGED
@@ -14,9 +14,9 @@ Including another URLconf
14
  1. Import the include() function: from django.urls import include, path
15
  2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
16
  """
17
- from django.contrib import admin
18
- from django.urls import path
19
 
20
  urlpatterns = [
21
- path('admin/', admin.site.urls),
22
- ]
 
14
  1. Import the include() function: from django.urls import include, path
15
  2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
16
  """
17
+ from django.urls import path
18
+ from lists.views import home_page
19
 
20
  urlpatterns = [
21
+ path("", home_page, name="home"),
22
+ ]