diff options
Diffstat (limited to 'ctrack/users/tests/test_functional.py')
-rw-r--r-- | ctrack/users/tests/test_functional.py | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/ctrack/users/tests/test_functional.py b/ctrack/users/tests/test_functional.py index 6403d0b..2ba5faf 100644 --- a/ctrack/users/tests/test_functional.py +++ b/ctrack/users/tests/test_functional.py @@ -1,12 +1,34 @@ +""" +Functional tests. Are probably SLOW thanks to using Selenium to load a browser instance. + +The use case being tested here is related to a user being able to log in and hit +the correct page, containing their details. Those details depend on whether they are +a regular user or a stakeholder user. +""" + +import time + import pytest from ctrack.organisations.models import Stakeholder +from ctrack.users.models import User pytestmark = pytest.mark.django_db -def test_profile_page_html(person, user, browser): +def test_user_can_log_in(browser, live_server): + 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 + "/users/toss/" + + +def test_profile_page_html(person, user, browser, live_server): stakeholder = Stakeholder.objects.create(person=person) user.stakeholder = stakeholder user.save() - browser.get(f"http://localhost:8000/users/{user.username}") + browser.get(live_server + f"/users/{user.username}/") |