From 1e2cc408deaf85b2d722bd7f9ca6eb027637fec4 Mon Sep 17 00:00:00 2001 From: Ignacio Date: Wed, 23 Oct 2024 13:16:53 -0600 Subject: [PATCH] Url config. Map / to home_page view --- lists/tests.py | 10 ++++------ superlists/urls.py | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lists/tests.py b/lists/tests.py index 7ab946f..652b55c 100644 --- a/lists/tests.py +++ b/lists/tests.py @@ -5,9 +5,7 @@ from lists.views import home_page # Create your tests here. class HomePageTest(TestCase): def test_home_page_returns_correct_html(self): - request = HttpRequest() - response = home_page(request) - html = response.content.decode("utf8") - self.assertIn("To-Do lists", html) - self.assertTrue(html.startswith("")) - self.assertTrue(html.endswith("")) \ No newline at end of file + response = self.client.get("/") + self.assertContains(response, "To-Do lists") + self.assertContains(response, "") + self.assertContains(response, "") \ No newline at end of file diff --git a/superlists/urls.py b/superlists/urls.py index ee74739..d7dfd17 100644 --- a/superlists/urls.py +++ b/superlists/urls.py @@ -14,9 +14,9 @@ Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ -from django.contrib import admin from django.urls import path +from lists.views import home_page urlpatterns = [ - path('admin/', admin.site.urls), + path("", home_page, name="home"), ]