@@ -108,6 +108,41 @@ def test_read_individual_not_found(self):
108108
109109 self .assertEqual (response .status_code , 404 )
110110
111+ def test_read_individual_no_identifiers_returns_404 (self ):
112+ """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+ }
129+ )
130+
131+ no_consent_client = self .create_api_client (
132+ name = "No Consent Client For 404" ,
133+ scopes = [{"resource" : "individual" , "action" : "read" }],
134+ require_consent = False ,
135+ legal_basis = "public_interest" ,
136+ )
137+ token = self .generate_jwt_token (no_consent_client )
138+
139+ url = f"{ self .api_base_url } /urn:openspp:vocab:id-type%23test_national_id|NO-TYPE-001"
140+ response = self .url_open (url , headers = self ._get_headers (token = token ))
141+
142+ # Partner exists but to_api_schema returns None (no valid identifiers)
143+ # Router should return 404
144+ self .assertEqual (response .status_code , 404 )
145+
111146 def test_read_individual_invalid_format (self ):
112147 """GET with invalid identifier format returns 400"""
113148 url = f"{ self .api_base_url } /INVALID-FORMAT"
0 commit comments