Coverage for tests/test_secures.py: 100%
19 statements
« prev ^ index » next coverage.py v7.14.1, created at 2026-06-05 11:17 +0200
« prev ^ index » next coverage.py v7.14.1, created at 2026-06-05 11:17 +0200
1"""Tests du sous-client secures (synchrone et asynchrone)."""
3from __future__ import annotations
5from unittest.mock import AsyncMock, MagicMock
7from henrri_connect.connect import (
8 AsyncHenrriClient, SyncHenrriClient, # type: ignore[import]
9)
10from tests.conftest import make_response
13class TestSyncSecures: # pylint: disable=R0903
14 """Tests du sous-client secures (synchrone)."""
15 def test_hello_world_retourne_texte(
16 self, sync_client: SyncHenrriClient, mock_http: MagicMock
17 ) -> None:
18 """Test de la méthode hello_world()."""
19 resp = make_response({}, text="Hello World!")
20 mock_http.request.return_value = resp
22 result = sync_client.secures.hello_world()
24 assert result == "Hello World!"
25 assert "/v1/secures/hello-world" in mock_http.request.call_args.args[1]
26 assert mock_http.request.call_args.args[0] == "GET"
29class TestAsyncSecures: # pylint: disable=R0903
30 """Tests du sous-client secures (asynchrone)."""
31 async def test_hello_world_retourne_texte(
32 self, async_client: AsyncHenrriClient, mock_async_http: AsyncMock
33 ) -> None:
34 """Test de la méthode hello_world()."""
35 resp = make_response({}, text="Hello World!")
36 mock_async_http.request.return_value = resp
38 result = await async_client.secures.hello_world()
40 assert result == "Hello World!"
41 assert "/v1/secures/hello-world" in mock_async_http.request.call_args.args[1]