diff --git a/src/tests/conftest.py b/src/tests/conftest.py index d956d39..d88870e 100644 --- a/src/tests/conftest.py +++ b/src/tests/conftest.py @@ -1,12 +1,18 @@ import pytest -from servala.core.models import Organization, OrganizationMembership, User, OrganizationOrigin +from servala.core.models import ( + Organization, + OrganizationMembership, + OrganizationOrigin, + User, +) @pytest.fixture def origin(): return OrganizationOrigin.objects.create(name="TESTORIGIN") + @pytest.fixture def organization(origin): return Organization.objects.create(name="Test Org", origin=origin) @@ -16,9 +22,11 @@ def organization(origin): def other_organization(origin): return Organization.objects.create(name="Test Org Alternate", origin=origin) + @pytest.fixture def org_owner(organization): user = User.objects.create(email="user@example.org", password="example") - OrganizationMembership.objects.create(organization=organization, user=user, role="owner") + OrganizationMembership.objects.create( + organization=organization, user=user, role="owner" + ) return user - diff --git a/src/tests/test_views.py b/src/tests/test_views.py index adf7d29..23475fc 100644 --- a/src/tests/test_views.py +++ b/src/tests/test_views.py @@ -1,10 +1,13 @@ import pytest -@pytest.mark.parametrize("url,redirect", ( - ("/", "/accounts/login/?next=/"), - ("/accounts/profile/", "/accounts/login/?next=/accounts/profile/") -)) +@pytest.mark.parametrize( + "url,redirect", + ( + ("/", "/accounts/login/?next=/"), + ("/accounts/profile/", "/accounts/login/?next=/accounts/profile/"), + ), +) def test_root_view_redirects_valid_urls(client, url, redirect): response = client.get(url) assert response.status_code == 302 @@ -33,7 +36,9 @@ def test_user_cannot_see_other_organization(client, org_owner, other_organizatio @pytest.mark.django_db -def test_organization_linked_in_sidebar(client, org_owner, organization, other_organization): +def test_organization_linked_in_sidebar( + client, org_owner, organization, other_organization +): client.force_login(org_owner) response = client.get("/", follow=True) assert response.status_code == 200