@@ -110,22 +110,13 @@ def test_read_individual_not_found(self):
110110
111111 def test_read_individual_no_identifiers_returns_404 (self ):
112112 """GET individual without valid identifiers returns 404"""
113- # Create individual without registry IDs but with a known identifier
114- # to look it up. The partner exists but has no reg_ids, so
115- # to_api_schema returns None and the router returns 404.
116- no_id_partner = self .env ["res.partner" ].create (
117- {
118- "name" : "No Identifier Person" ,
119- "is_registrant" : True ,
120- "is_group" : False ,
121- }
122- )
123- # Add a reg_id with a value but no id_type (invalid identifier)
124- self .env ["spp.registry.id" ].create (
125- {
126- "registrant_id" : no_id_partner .id ,
127- "value" : "NO-TYPE-001" ,
128- }
113+ # Create individual with a known identifier, then remove all reg_ids
114+ # so to_api_schema returns None and the router returns 404.
115+ no_id_partner = self .create_test_individual (
116+ name = "Will Lose IDs" ,
117+ given_name = "Will" ,
118+ family_name = "LoseIDs" ,
119+ identifier_value = "WILL-LOSE-001" ,
129120 )
130121
131122 no_consent_client = self .create_api_client (
@@ -136,11 +127,13 @@ def test_read_individual_no_identifiers_returns_404(self):
136127 )
137128 token = self .generate_jwt_token (no_consent_client )
138129
139- url = f"{ self .api_base_url } /urn:openspp:vocab:id-type%23test_national_id|NO-TYPE-001"
130+ # Delete all registry IDs to simulate missing identifiers
131+ no_id_partner .reg_ids .unlink ()
132+
133+ url = f"{ self .api_base_url } /urn:openspp:vocab:id-type%23test_national_id|WILL-LOSE-001"
140134 response = self .url_open (url , headers = self ._get_headers (token = token ))
141135
142- # Partner exists but to_api_schema returns None (no valid identifiers)
143- # Router should return 404
136+ # Partner's identifier was deleted, so lookup by identifier returns 404
144137 self .assertEqual (response .status_code , 404 )
145138
146139 def test_read_individual_invalid_format (self ):
0 commit comments