aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ctrack/templates/pages/home.html1
-rw-r--r--ctrack/users/tests/test_functional.py4
-rw-r--r--ctrack/users/tests/test_views.py16
3 files changed, 20 insertions, 1 deletions
diff --git a/ctrack/templates/pages/home.html b/ctrack/templates/pages/home.html
index bc70c17..36a3abf 100644
--- a/ctrack/templates/pages/home.html
+++ b/ctrack/templates/pages/home.html
@@ -5,5 +5,6 @@
<h1>Welcome to ctrack - Department for Transport</h1>
<p>User: {{ object }}</p>
+ <p>THIS IS A TEMPLATE FOR A REGULAR USER</p>
{% endblock content %}
diff --git a/ctrack/users/tests/test_functional.py b/ctrack/users/tests/test_functional.py
index 18dd477..c68382c 100644
--- a/ctrack/users/tests/test_functional.py
+++ b/ctrack/users/tests/test_functional.py
@@ -38,3 +38,7 @@ def test_user_can_log_in(browser, person, live_server):
# Such as his own name in an H1 tag!
h1 = browser.find_element_by_tag_name("h1")
assert h1.text == "Welcome to ctrack - Department for Transport"
+ type_user_message = browser.find_elements_by_tag_name("p")
+ assert "THIS IS A TEMPLATE FOR A REGULAR USER" in [
+ m.text for m in type_user_message
+ ]
diff --git a/ctrack/users/tests/test_views.py b/ctrack/users/tests/test_views.py
index da00a0d..6859215 100644
--- a/ctrack/users/tests/test_views.py
+++ b/ctrack/users/tests/test_views.py
@@ -84,7 +84,7 @@ def test_profile_view_contains_organisation_information(person, user):
assert response.context_data["user"].stakeholder.person.first_name == "Toss"
-def test_home_page_h1_tag_with_client(person, client, django_user_model):
+def test_home_page_h1_tag_with_client(client, django_user_model):
"""
Basic test of HTML from the home page.
"""
@@ -96,3 +96,17 @@ def test_home_page_h1_tag_with_client(person, client, django_user_model):
assert b"<title>ctrack - Department for Transport</title>" in response.content
assert b"<h1>Welcome to ctrack - Department for Transport</h1>" in response.content
assert b"</html>" in response.content
+
+
+def test_regular_user_gets_regular_user_template(django_user_model):
+ """
+ When a user logs in without a stakeholder mapping, they get sent to the regular user
+ template.
+ """
+ user = django_user_model.objects.create_user(username="toss", password="knob")
+ factory = RequestFactory()
+ request = factory.get("/")
+ request.user = user
+ response = home_page(request)
+ assert response.status_code == 200
+ assert b"<p>THIS IS A TEMPLATE FOR A REGULAR USER</p>" in response.content