-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from sinch/DEVEXP_758-SinchClient_Config
DEVEXP-758: SinchClient Configuration
- Loading branch information
Showing
3 changed files
with
98 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,30 @@ | ||
import pytest | ||
from sinch import SinchClient, SinchClientAsync | ||
from sinch.core.clients.sinch_client_configuration import Configuration | ||
|
||
|
||
def test_sinch_client_initialization(): | ||
sinch_client_sync = SinchClient( | ||
key_id="test", | ||
key_secret="test_secret", | ||
project_id="test_project_id" | ||
) | ||
assert sinch_client_sync | ||
|
||
|
||
def test_sinch_client_async_initialization(): | ||
sinch_client_async = SinchClientAsync( | ||
@pytest.mark.parametrize("client", [SinchClient, SinchClientAsync]) | ||
def test_sinch_client_initialization(client): | ||
""" Test that SinchClient and SinchClientAsync can be initialized with or without parameters """ | ||
sinch_client = client( | ||
key_id="test", | ||
key_secret="test_secret", | ||
project_id="test_project_id" | ||
) | ||
assert sinch_client_async | ||
|
||
|
||
def test_sinch_client_has_all_business_domains(sinch_client_sync): | ||
assert hasattr(sinch_client_sync, "authentication") | ||
assert hasattr(sinch_client_sync, "sms") | ||
assert hasattr(sinch_client_sync, "conversation") | ||
assert hasattr(sinch_client_sync, "numbers") | ||
|
||
|
||
def test_sinch_client_async_has_all_business_domains(sinch_client_async): | ||
assert hasattr(sinch_client_async, "authentication") | ||
assert hasattr(sinch_client_async, "sms") | ||
assert hasattr(sinch_client_async, "conversation") | ||
assert hasattr(sinch_client_async, "numbers") | ||
|
||
|
||
def test_sinch_client_has_configuration_object(sinch_client_sync): | ||
assert hasattr(sinch_client_sync, "configuration") | ||
assert isinstance(sinch_client_sync.configuration, Configuration) | ||
|
||
|
||
def test_sinch_client_async_has_configuration_object(sinch_client_async): | ||
assert hasattr(sinch_client_async, "configuration") | ||
assert isinstance(sinch_client_async.configuration, Configuration) | ||
assert sinch_client | ||
|
||
sinch_client_empty = client() | ||
assert sinch_client_empty | ||
|
||
|
||
@pytest.mark.parametrize("client", ["sinch_client_sync", "sinch_client_async"]) | ||
def test_sinch_client_expects_all_attributes(request, client): | ||
""" Test that SinchClient and SinchClientAsync have all attributes""" | ||
client_instance = request.getfixturevalue(client) | ||
assert hasattr(client_instance, "authentication") | ||
assert hasattr(client_instance, "sms") | ||
assert hasattr(client_instance, "conversation") | ||
assert hasattr(client_instance, "numbers") | ||
assert hasattr(client_instance, "verification") | ||
assert hasattr(client_instance, "voice") | ||
assert hasattr(client_instance, "configuration") | ||
assert isinstance(client_instance.configuration, Configuration) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters