From f61853c366a1554f545b34783e1aa282022598b9 Mon Sep 17 00:00:00 2001 From: Cody Logan Date: Wed, 1 Nov 2023 11:33:13 -0700 Subject: Add some explanatory comments to tests --- tests/test_client.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tests/test_client.py') diff --git a/tests/test_client.py b/tests/test_client.py index 832bf21..cf6e29c 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -31,6 +31,10 @@ class TestQueryApi: def test_connect_to_site( self, mock_site: MagicMock, caplog: pytest.LogCaptureFixture ) -> None: + """ + The connect_to_site function should create a debug log message recording the + name of the site we're connecting to. + """ caplog.set_level(logging.DEBUG) mock_site.return_value = MagicMock() args = construct_parser().parse_args(["File:Example.jpg"]) @@ -40,7 +44,12 @@ class TestQueryApi: @pytest.mark.skip(reason="skip tests that query a live API") def test_query_api(self, caplog: pytest.LogCaptureFixture) -> None: + """ + The query_api function should create a debug log message containing the user + agent we're sending to the API. + """ caplog.set_level(logging.DEBUG) - site = connect_to_site("commons.wikimedia.org", self.args) + args = construct_parser().parse_args(["File:Example.jpg"]) + site = connect_to_site("commons.wikimedia.org", args) _ = query_api("Example.jpg", site) assert USER_AGENT in caplog.text -- cgit v1.2.3