diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-05-26 21:22:51 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-05-26 21:22:51 +0100 |
commit | ca2272bca90fc1fb7dbd78a2458ae921d5ffa59e (patch) | |
tree | 415fe963685c3ea3573a094b12d1e4d16e9c2664 /ctrack/users/tests/test_views.py | |
parent | 055f13ec1a20a2043daee6c7784045ae06e92236 (diff) |
regular user goes to regular user home page template when logging in
Diffstat (limited to 'ctrack/users/tests/test_views.py')
-rw-r--r-- | ctrack/users/tests/test_views.py | 16 |
1 files changed, 15 insertions, 1 deletions
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 |