File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77)
88
99# constants
10- VALID_HOUSEHOLD_ID = " 123"
11- VALID_POLICY_ID = " 456"
10+ VALID_HOUSEHOLD_ID = 123
11+ VALID_POLICY_ID = 456
1212INVALID_HOUSEHOLD_ID = "abc123"
1313INVALID_POLICY_ID = "invalid-id"
1414TEST_VARIABLE = "disposable_income"
15- INVALID_VARIABLE = " 123"
15+ INVALID_VARIABLE = 123
1616
1717
1818@patch ("policyengine_api.services.tracer_analysis_service.local_database" )
@@ -191,7 +191,7 @@ def test_invalid_variable_type(rest_client):
191191 json = {
192192 "household_id" : VALID_HOUSEHOLD_ID ,
193193 "policy_id" : VALID_POLICY_ID ,
194- "variable" : 123 ,
194+ "variable" : INVALID_VARIABLE ,
195195 },
196196 )
197197 assert response .status_code == 400
@@ -212,3 +212,13 @@ def test_empty_payload(rest_client):
212212 response = rest_client .post ("/us/tracer-analysis" , json = {})
213213 assert response .status_code == 400
214214 assert "No payload provided" in json .loads (response .data )["message" ]
215+
216+
217+ def test_invalid_content_type (rest_client ):
218+ """Test that non-JSON content type is rejected"""
219+ response = rest_client .post (
220+ "/us/tracer-analysis" ,
221+ data = "some data" ,
222+ content_type = "text/plain" , # Invalid content type
223+ )
224+ assert response .status_code == 415
You can’t perform that action at this time.
0 commit comments