diff --git a/dhlmex/client.py b/dhlmex/client.py index 09ef370..c5d641b 100644 --- a/dhlmex/client.py +++ b/dhlmex/client.py @@ -22,7 +22,7 @@ class Client: ... def __init__( - self, username: Optional[str] = None, password: Optional[str] = None + self, username: Optional[str] = None, password: Optional[str] = None, ): username = username or os.environ['DHLMEX_USERNAME'] password = password or os.environ['DHLMEX_PASSWORD'] diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..c08cb26 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,14 @@ +import pytest +from requests import Request + + +def remove_creds(request: Request) -> Request: + # remove username and password + return request + + +@pytest.fixture(scope='module') +def vcr_config() -> dict: + config = dict() + config['before_record_request'] = remove_creds + return config \ No newline at end of file diff --git a/tests/test_client_login.py b/tests/test_client_login.py new file mode 100644 index 0000000..7098df3 --- /dev/null +++ b/tests/test_client_login.py @@ -0,0 +1,14 @@ +import os + +import pytest + +from dhlmex import Client + +DHLMEX_USERNAME = os.environ['DHLMEX_USERNAME'] +DHLMEX_PASSWORD = os.environ['DHLMEX_PASSWORD'] + + +@pytest.mark.vcr +def test_successful_login(): + assert Client(DHLMEX_USERNAME, DHLMEX_PASSWORD) +