Skip to content

Commit ad6285f

Browse files
Make sure test hits elusive line for code coverage
1 parent 8505b37 commit ad6285f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tests/unit_tests/test_client.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,20 @@
88
from daq_config_server.constants import ENDPOINTS
99

1010

11-
# More useful tests for the client are in tests/system_tests
1211
@patch("daq_config_server.client.requests.get")
13-
def test_get_file_contents(mock_request: MagicMock):
14-
mock_request.return_value = Response(status_code=status.HTTP_200_OK, json="test")
12+
def test_get_file_contents_default_header(mock_request: MagicMock):
13+
content_type = ValidAcceptHeaders.PLAIN_TEXT
14+
mock_request.return_value = Response(
15+
status_code=status.HTTP_200_OK,
16+
content="test",
17+
headers={
18+
"content-type": content_type,
19+
},
20+
)
1521
file_path = "test"
1622
url = "url"
1723
server = ConfigServer(url)
18-
server.get_file_contents(file_path)
24+
assert server.get_file_contents(file_path) == "test"
1925
mock_request.assert_called_once_with(
2026
url + ENDPOINTS.CONFIG + "/" + file_path,
2127
headers={"Accept": RequestedResponseFormats.DECODED_STRING},
@@ -61,7 +67,6 @@ def test_logger_warning_if_content_type_doesnt_match_requested_type(
6167
text = "text"
6268
mock_request.return_value = Response(
6369
status_code=status.HTTP_200_OK,
64-
json="test",
6570
headers={
6671
"content-type": content_type,
6772
},

0 commit comments

Comments
 (0)