|
| 1 | +import pytest |
| 2 | +from logging import Logger, getLogger |
1 | 3 | from sinch.core.clients.sinch_client_configuration import Configuration
|
2 | 4 | from sinch.core.adapters.requests_http_transport import HTTPTransportRequests
|
3 |
| -from sinch.core.token_manager import TokenManager |
| 5 | +from sinch.core.adapters.httpx_adapter import HTTPXTransport |
| 6 | +from sinch.core.token_manager import TokenManager, TokenManagerAsync |
| 7 | + |
| 8 | + |
| 9 | +@pytest.mark.parametrize( |
| 10 | + "transport_class, token_manager_class, client_fixture", |
| 11 | + [ |
| 12 | + (HTTPTransportRequests, TokenManager, "sinch_client_sync"), |
| 13 | + (HTTPXTransport, TokenManagerAsync, "sinch_client_async") |
| 14 | + ] |
| 15 | +) |
| 16 | +def test_configuration_happy_capy_expects_initialization( |
| 17 | + request, transport_class, token_manager_class, client_fixture |
| 18 | + ): |
| 19 | + """ Test that Configuration can be initialized with all parameters """ |
| 20 | + sinch_client = request.getfixturevalue(client_fixture) |
4 | 21 |
|
5 |
| - |
6 |
| -def test_configuration_initialization_happy_path(sinch_client_sync): |
7 | 22 | client_configuration = Configuration(
|
8 |
| - key_id="Rodney", |
9 |
| - key_secret="Mullen", |
10 |
| - project_id="Is the King!", |
11 |
| - transport=HTTPTransportRequests(sinch_client_sync), |
12 |
| - token_manager=TokenManager(sinch_client_sync) |
| 23 | + key_id="CapyKey", |
| 24 | + key_secret="CapybaraWhisper", |
| 25 | + project_id="CapybaraProjectX", |
| 26 | + logger=getLogger("CapyTrace"), |
| 27 | + connection_timeout=10, |
| 28 | + application_key="AppybaraKey", |
| 29 | + application_secret="SecretHabitatEntry", |
| 30 | + service_plan_id="CappyPremiumPlan", |
| 31 | + sms_api_token="HappyCappyToken", |
| 32 | + transport=transport_class(sinch_client), |
| 33 | + token_manager=token_manager_class(sinch_client) |
13 | 34 | )
|
14 |
| - assert client_configuration.key_id == "Rodney" |
15 |
| - assert client_configuration.key_secret == "Mullen" |
16 |
| - assert client_configuration.project_id == "Is the King!" |
17 |
| - assert isinstance(client_configuration.transport, HTTPTransportRequests) |
18 |
| - assert isinstance(client_configuration.token_manager, TokenManager) |
| 35 | + |
| 36 | + assert client_configuration.key_id == "CapyKey" |
| 37 | + assert client_configuration.key_secret == "CapybaraWhisper" |
| 38 | + assert client_configuration.project_id == "CapybaraProjectX" |
| 39 | + assert isinstance(client_configuration.logger, Logger) |
| 40 | + assert client_configuration.application_key == "AppybaraKey" |
| 41 | + assert client_configuration.application_secret == "SecretHabitatEntry" |
| 42 | + assert client_configuration.service_plan_id == "CappyPremiumPlan" |
| 43 | + assert client_configuration.sms_api_token == "HappyCappyToken" |
| 44 | + assert isinstance(client_configuration.transport, transport_class) |
| 45 | + assert isinstance(client_configuration.token_manager, token_manager_class) |
19 | 46 |
|
20 | 47 |
|
21 | 48 | def test_set_sms_region_property_and_check_that_sms_origin_was_updated(sinch_client_sync):
|
|
0 commit comments