aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/users/tests/test_functional.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ctrack/users/tests/test_functional.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/ctrack/users/tests/test_functional.py b/ctrack/users/tests/test_functional.py
index c68382c..d5390f6 100644
--- a/ctrack/users/tests/test_functional.py
+++ b/ctrack/users/tests/test_functional.py
@@ -16,9 +16,31 @@ from ctrack.users.models import User
pytestmark = pytest.mark.django_db
-def test_user_can_log_in(browser, person, live_server):
+def test_regular_user_can_log_in(browser, person, live_server):
# Toss McBride is an OES user. He logs into the system...
+ User.objects.create_user(username="toss", password="knob")
+ browser.get(live_server + "/accounts/login")
+ browser.find_element_by_id("id_login").send_keys("toss")
+ browser.find_element_by_id("id_password").send_keys("knob")
+ browser.find_element_by_id("sign_in_button").submit()
+ time.sleep(1)
+ current_url = browser.current_url
+ assert current_url == live_server + "/"
+
+ # On the other side, he sees some basic details about himself.
+ assert "ctrack - Department for Transport" in browser.title
+
+ 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
+ ]
+
+
+def test_stakeholder_can_log_in_and_see_their_home(browser, person, live_server):
+ # Toss McBride is an OES user. He logs into the system...
stakeholder = Stakeholder.objects.create(person=person)
user = User.objects.create_user(username="toss", password="knob")
@@ -39,6 +61,6 @@ def test_user_can_log_in(browser, person, live_server):
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 [
+ assert "THIS IS A TEMPLATE FOR A STAKEHOLDER USER" in [
m.text for m in type_user_message
]