Skip to content

Commit

Permalink
Implement hardcoded question page and test
Browse files Browse the repository at this point in the history
Our first end-to-end test
  • Loading branch information
duncanjbrown committed Mar 1, 2024
1 parent cc5afcb commit 378ad72
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
How should funding be allocated?
4 changes: 4 additions & 0 deletions consultation_analyser/consultations/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from django.urls import path
from .views import show_question

urlpatterns = [path("questions/how-should-funding-be-allocated", show_question)]
7 changes: 6 additions & 1 deletion consultation_analyser/consultations/views.py
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
# Create your views here.
from django.shortcuts import render
from django.http import HttpRequest


def show_question(request: HttpRequest):
return render(request, "show_question.html")
2 changes: 1 addition & 1 deletion consultation_analyser/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]

# ROOT_URLCONF = "consultation_analyser.urls"
ROOT_URLCONF = "consultation_analyser.urls"

TEMPLATES = [
{
Expand Down
5 changes: 4 additions & 1 deletion consultation_analyser/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
# from django.urls import path
from django.urls import path, include
from consultation_analyser.consultations import urls

urlpatterns = [path("", include(urls))]
3 changes: 3 additions & 0 deletions tests/integration/test_question_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def test_get_question_page(client):
response = client.get("/questions/how-should-funding-be-allocated")
assert "How should funding be allocated?" in str(response.content)

0 comments on commit 378ad72

Please sign in to comment.