Skip to content

Commit dff92d1

Browse files
committed
CI does not believe in caplog :/, by Piotr
1 parent 5b5cfaf commit dff92d1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/test_students.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,16 @@ def test_returns_empty_list_when_no_usernames_found_in_api_response(self, mocker
4242
({"students": [{"username": "one"}]}, "You have 1 student!"),
4343
]
4444
)
45-
def test_uses_correct_grammar_in_log_messages(
46-
self, mocker, api_response, expected_wording, caplog
47-
):
45+
def test_uses_correct_grammar_in_log_messages(self, mocker, api_response, expected_wording):
4846
mock_students_api_get = mocker.patch("pythonanywhere.api.students_api.StudentsAPI.get")
4947
mock_students_api_get.return_value = api_response
48+
mock_snake = mocker.patch("pythonanywhere.students.snakesay")
49+
mock_info = mocker.patch("pythonanywhere.students.logger.info")
5050

5151
Students().get()
5252

53-
assert expected_wording in caplog.text
53+
assert mock_snake.call_args == call(expected_wording)
54+
assert mock_info.call_args == call(mock_snake.return_value)
5455

5556

5657
@pytest.mark.students

0 commit comments

Comments
 (0)