diff options
Diffstat (limited to '')
-rw-r--r-- | ctrack/users/tests/test_functional.py | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/ctrack/users/tests/test_functional.py b/ctrack/users/tests/test_functional.py index 1edb17e..74d72d0 100644 --- a/ctrack/users/tests/test_functional.py +++ b/ctrack/users/tests/test_functional.py @@ -15,7 +15,7 @@ from ctrack.users.models import User pytestmark = pytest.mark.django_db -def test_regular_user_can_log_in(browser, person, live_server): +def test_regular_user_can_log_in(browser, live_server): # Toss McBride is an OES user. He logs into the system... User.objects.create_user(username="toss", password="knob") @@ -38,9 +38,7 @@ def test_regular_user_can_log_in(browser, person, live_server): ] -def test_stakeholder_can_log_in_and_see_their_home( - browser, person, live_server, stakeholder -): +def test_stakeholder_can_log_in_and_see_their_home(browser, live_server, stakeholder): # Toss McBride is an OES user. He logs into the system... user = User.objects.create_user(username="toss", password="knob") @@ -64,3 +62,21 @@ def test_stakeholder_can_log_in_and_see_their_home( assert "THIS IS A TEMPLATE FOR A STAKEHOLDER USER" in [ m.text for m in type_user_message ] + + +def test_stakeholder_can_log_in_but_receieved_permisson_denied_when_off_piste( + browser, live_server, stakeholder +): + user = User.objects.create_user(username="toss", password="knob") + user.stakeholder = stakeholder + user.save() + 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) + # Try to browser to Organisations list + browser.get(live_server + "/organisations") + assert "Sorry. You are not authorised to view that page." in [ + x.text for x in browser.find_elements_by_tag_name("p") + ] |