Skip to content

Commit

Permalink
tests(version): add tests to fintoc version header
Browse files Browse the repository at this point in the history
  • Loading branch information
jfcumsille committed Apr 9, 2024
1 parent d5dff32 commit 7f05485
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@ def setup_method(self):
self.api_key = "super_secret_api_key"
self.user_agent = "fintoc-python/test"
self.params = {"first_param": "first_value", "second_param": "second_value"}
self.version = '2023-01-01'

def create_client(self, params=False):
if not params:
def create_client(self, params=False, version=False):
if not params and not version:
return Client(self.base_url, self.api_key, self.user_agent)
return Client(self.base_url, self.api_key, self.user_agent, params=self.params)
if params and not version:
return Client(self.base_url, self.api_key, self.user_agent, params=self.params)
if not params and version:
return Client(self.base_url, self.api_key, self.user_agent, version=self.version)
return Client(
self.base_url, self.api_key, self.user_agent, params=self.params, version=self.version
)

def test_client_creation_without_params(self):
client = self.create_client()
Expand All @@ -35,13 +42,14 @@ def test_client_creation_with_params(self):
assert client.params == self.params

def test_client_headers(self):
client = self.create_client()
client = self.create_client(version=True)
assert isinstance(client.headers, dict)
assert len(client.headers.keys()) == 2
assert len(client.headers.keys()) == 3
assert "Authorization" in client.headers
assert "User-Agent" in client.headers
assert client.headers["Authorization"] == self.api_key
assert client.headers["User-Agent"] == self.user_agent
assert client.headers["Fintoc-Version"] == self.version

def test_client_http_subclient_lazy_initialization(self):
# pylint: disable=protected-access
Expand Down

0 comments on commit 7f05485

Please sign in to comment.