Skip to content

Commit 6fde5cb

Browse files
committed
Added tests to cover the code at line 39 in the tracer_analysis_routes.py file.
1 parent 4620e5f commit 6fde5cb

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

tests/to_refactor/python/test_tracer_analysis_routes.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,18 @@ def test_empty_payload(rest_client):
214214
assert "No payload provided" in json.loads(response.data)["message"]
215215

216216

217-
def test_invalid_content_type(rest_client):
218-
"""Test that non-JSON content type is rejected"""
217+
def test_validate_tracer_analysis_payload_failure(rest_client):
218+
"""Test handling of invalid payload from validate_tracer_analysis_payload"""
219219
response = rest_client.post(
220220
"/us/tracer-analysis",
221-
data="some data",
222-
content_type="text/plain", # Invalid content type
221+
json={
222+
# Missing required field 'variable'
223+
"household_id": VALID_HOUSEHOLD_ID,
224+
"policy_id": VALID_POLICY_ID,
225+
},
226+
)
227+
assert response.status_code == 400
228+
assert (
229+
"Missing required key: variable"
230+
in json.loads(response.data)["message"]
223231
)
224-
assert response.status_code == 415

0 commit comments

Comments
 (0)