Skip to content

Commit da713b8

Browse files
committed
Fixed docstrings in Splunk unit tests
1 parent 52801b5 commit da713b8

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

tests/unit/observability/test_splunk.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,22 @@
1212

1313
@pytest.fixture(name="mock_splunk_config")
1414
def mock_splunk_config_fixture(tmp_path: Path, mocker: MockerFixture) -> Any:
15-
"""Create a mock SplunkConfiguration."""
15+
"""Create a mock SplunkConfiguration.
16+
17+
Create a mocked Splunk configuration object for tests.
18+
19+
The returned mock has attributes pre-populated to simulate a valid Splunk HEC configuration:
20+
- enabled = True
21+
- url = "https://splunk.example.com:8088/services/collector"
22+
- token_path = Path to a temporary file containing "test-hec-token"
23+
- index = "test_index"
24+
- source = "test-source"
25+
- timeout = 5
26+
- verify_ssl = True
27+
28+
Returns:
29+
mock_config: A MagicMock configured with the above Splunk fields.
30+
"""
1631
token_file = tmp_path / "token"
1732
token_file.write_text("test-hec-token")
1833

@@ -29,7 +44,16 @@ def mock_splunk_config_fixture(tmp_path: Path, mocker: MockerFixture) -> Any:
2944

3045
@pytest.fixture(name="mock_session")
3146
def mock_session_fixture(mocker: MockerFixture) -> Any:
32-
"""Create a mock aiohttp session with successful response."""
47+
"""Create a mock aiohttp session with successful response.
48+
49+
Parameters:
50+
- mocker (pytest_mock.MockerFixture): Fixture used to create AsyncMock objects.
51+
52+
Returns:
53+
AsyncMock: A mock session (`spec=aiohttp.ClientSession`) whose `post()`
54+
returns an async context manager that yields a response mock with
55+
`status = 200`.
56+
"""
3357
mock_response = mocker.AsyncMock()
3458
mock_response.status = 200
3559
session = mocker.AsyncMock(spec=aiohttp.ClientSession)

0 commit comments

Comments
 (0)