Skip to content

Commit

Permalink
Test: add test case for empty response for covjson converter
Browse files Browse the repository at this point in the history
  • Loading branch information
fjugipe committed Jan 25, 2024
1 parent 0591b31 commit a7acc39
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion api/test/test_covjson.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import json

import datastore_pb2 as dstore
import pytest
from covjson_pydantic.coverage import Coverage
from fastapi import HTTPException
from formatters.covjson import Covjson
from google.protobuf.json_format import Parse

Expand Down Expand Up @@ -61,7 +63,12 @@ def test_single_parameter_area_convert():


def test_empty_response_convert():
pass
test_data = load_json("test/test_data/test_empty.json")
response = create_mock_obs_response(test_data)

# Expect to get an HTTPException when converting an empty response
with pytest.raises(HTTPException):
Covjson().convert(response)


def create_mock_obs_response(json_data):
Expand Down
3 changes: 3 additions & 0 deletions api/test/test_data/test_empty.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"observations": []
}

0 comments on commit a7acc39

Please sign in to comment.