|
| 1 | +import pytest |
1 | 2 | from sinch import SinchClient, SinchClientAsync
|
2 | 3 | from sinch.core.clients.sinch_client_configuration import Configuration
|
3 | 4 |
|
4 |
| - |
5 |
| -def test_sinch_client_initialization(): |
6 |
| - sinch_client_sync = SinchClient( |
7 |
| - key_id="test", |
8 |
| - key_secret="test_secret", |
9 |
| - project_id="test_project_id" |
10 |
| - ) |
11 |
| - assert sinch_client_sync |
12 |
| - |
13 |
| - |
14 |
| -def test_sinch_client_async_initialization(): |
15 |
| - sinch_client_async = SinchClientAsync( |
| 5 | +@pytest.mark.parametrize("client", [SinchClient, SinchClientAsync]) |
| 6 | +def test_sinch_client_initialization(client): |
| 7 | + """ Test that SinchClient and SinchClientAsync can be initialized with or without parameters """ |
| 8 | + sinch_client = client( |
16 | 9 | key_id="test",
|
17 | 10 | key_secret="test_secret",
|
18 | 11 | project_id="test_project_id"
|
19 | 12 | )
|
20 |
| - assert sinch_client_async |
21 |
| - |
22 |
| - |
23 |
| -def test_sinch_client_has_all_business_domains(sinch_client_sync): |
24 |
| - assert hasattr(sinch_client_sync, "authentication") |
25 |
| - assert hasattr(sinch_client_sync, "sms") |
26 |
| - assert hasattr(sinch_client_sync, "conversation") |
27 |
| - assert hasattr(sinch_client_sync, "numbers") |
28 |
| - |
29 |
| - |
30 |
| -def test_sinch_client_async_has_all_business_domains(sinch_client_async): |
31 |
| - assert hasattr(sinch_client_async, "authentication") |
32 |
| - assert hasattr(sinch_client_async, "sms") |
33 |
| - assert hasattr(sinch_client_async, "conversation") |
34 |
| - assert hasattr(sinch_client_async, "numbers") |
35 |
| - |
36 |
| - |
37 |
| -def test_sinch_client_has_configuration_object(sinch_client_sync): |
38 |
| - assert hasattr(sinch_client_sync, "configuration") |
39 |
| - assert isinstance(sinch_client_sync.configuration, Configuration) |
40 |
| - |
41 |
| - |
42 |
| -def test_sinch_client_async_has_configuration_object(sinch_client_async): |
43 |
| - assert hasattr(sinch_client_async, "configuration") |
44 |
| - assert isinstance(sinch_client_async.configuration, Configuration) |
| 13 | + assert sinch_client |
| 14 | + |
| 15 | + sinch_client_empty = client() |
| 16 | + assert sinch_client_empty |
| 17 | + |
| 18 | + |
| 19 | +@pytest.mark.parametrize("client", ["sinch_client_sync", "sinch_client_async"]) |
| 20 | +def test_sinch_client_expects_all_attributes(request, client): |
| 21 | + """ Test that SinchClient and SinchClientAsync have all attributes""" |
| 22 | + client_instance = request.getfixturevalue(client) |
| 23 | + assert hasattr(client_instance, "authentication") |
| 24 | + assert hasattr(client_instance, "sms") |
| 25 | + assert hasattr(client_instance, "conversation") |
| 26 | + assert hasattr(client_instance, "numbers") |
| 27 | + assert hasattr(client_instance, "verification") |
| 28 | + assert hasattr(client_instance, "voice") |
| 29 | + assert hasattr(client_instance, "configuration") |
| 30 | + assert isinstance(client_instance.configuration, Configuration) |
0 commit comments