@@ -22,14 +22,16 @@ def _url(name: str, **path_params) -> str:
2222class GetPageCase :
2323 id : str
2424 client_fixture : str
25- path_factory : Callable [[], str ]
25+ path_factory : Callable [[], str | None ]
2626 marker : str | None = None
2727 jinja_route : str | None = None
2828 expected_status : int = 200
2929
3030
3131GET_PAGE_CASES = [
32- GetPageCase ("home" , "unauth_client" , lambda : _url ("read_home" ), jinja_route = "read_home" ),
32+ GetPageCase (
33+ "home" , "unauth_client" , lambda : _url ("read_home" ), jinja_route = "read_home"
34+ ),
3335 GetPageCase (
3436 "login" , "unauth_client" , lambda : _url ("read_login" ), jinja_route = "read_login"
3537 ),
@@ -68,14 +70,14 @@ class GetPageCase:
6870 GetPageCase (
6971 "organization_owner" ,
7072 "auth_client_owner" ,
71- lambda : _url ( "read_organization" , org_id = 0 ) ,
73+ lambda : None ,
7274 marker = "Create Role" ,
7375 jinja_route = "read_organization" ,
7476 ),
7577 GetPageCase (
7678 "organization_member" ,
7779 "auth_client_member" ,
78- lambda : _url ( "read_organization" , org_id = 0 ) ,
80+ lambda : None ,
7981 marker = "Members" ,
8082 jinja_route = "read_organization" ,
8183 ),
@@ -99,7 +101,8 @@ def _setup_org_owner(
99101 test_organization ,
100102 org_owner ,
101103 ):
102- """Ensure org-scoped clients have a membership relationship loaded."""
104+ # No setup body: autouse only so test_organization and org_owner run before
105+ # org-scoped client fixtures (auth_client_owner, auth_client_member).
103106 del request , test_organization , org_owner
104107
105108 def test_static_context_analysis_passes (self , missing_context_variables ):
@@ -139,7 +142,7 @@ def test_get_page_renders(
139142 assert not missing_context_variables
140143 client = request .getfixturevalue (case .client_fixture )
141144 path = case .path_factory ()
142- if "organization" in case . id :
145+ if path is None :
143146 assert test_organization .id is not None
144147 path = _url ("read_organization" , org_id = test_organization .id )
145148 response = client .get (path )
@@ -215,7 +218,7 @@ class TestGetPagesRequireAuth:
215218 [
216219 ("unauth_client" , lambda : _url ("read_dashboard" )),
217220 ("unauth_client" , lambda : _url ("read_profile" )),
218- ("unauth_client" , lambda : _url ( "read_organization" , org_id = 1 ) ),
221+ ("unauth_client" , lambda : None ),
219222 ],
220223 ids = ["dashboard" , "profile" , "organization" ],
221224 )
@@ -228,7 +231,7 @@ def test_unauthenticated_redirects_to_login(
228231 ):
229232 client = request .getfixturevalue (client_fixture )
230233 path = path_factory ()
231- if "organization" in request . node . callspec . id :
234+ if path is None :
232235 assert test_organization .id is not None
233236 path = _url ("read_organization" , org_id = test_organization .id )
234237 response = client .get (path )
0 commit comments