diff options
Diffstat (limited to 'ctrack/users')
-rw-r--r-- | ctrack/users/tests/test_functional.py | 12 | ||||
-rw-r--r-- | ctrack/users/tests/test_views.py | 7 |
2 files changed, 14 insertions, 5 deletions
diff --git a/ctrack/users/tests/test_functional.py b/ctrack/users/tests/test_functional.py new file mode 100644 index 0000000..6403d0b --- /dev/null +++ b/ctrack/users/tests/test_functional.py @@ -0,0 +1,12 @@ +import pytest + +from ctrack.organisations.models import Stakeholder + +pytestmark = pytest.mark.django_db + + +def test_profile_page_html(person, user, browser): + stakeholder = Stakeholder.objects.create(person=person) + user.stakeholder = stakeholder + user.save() + browser.get(f"http://localhost:8000/users/{user.username}") diff --git a/ctrack/users/tests/test_views.py b/ctrack/users/tests/test_views.py index 73d694c..0f57b36 100644 --- a/ctrack/users/tests/test_views.py +++ b/ctrack/users/tests/test_views.py @@ -48,14 +48,11 @@ class TestUserRedirectView: assert view.get_redirect_url() == f"/users/{user.username}/" -def test_profile_view_contains_organisation_information(person): +def test_profile_view_contains_organisation_information(person, user): """url: users/username This is where users are redirected to when they log in and where I want to capture information about the user - particularly if they are an OES user. """ - user = get_user_model().objects.create_user( - username="testy", email="testy@test.com", password="test1020" - ) org_name = person.organisation.name stakeholder = Stakeholder.objects.create(person=person) user.stakeholder = stakeholder @@ -71,7 +68,7 @@ def test_profile_view_contains_organisation_information(person): response = UserDetailView.as_view()(request, username=user.username) assert response.status_code == 200 - assert response.context_data["user"].username == "testy" + assert response.context_data["user"].username == user.username assert response.context_data["user"].is_stakeholder() is True assert response.context_data["user"].stakeholder.person.first_name == "Chinaplate" |