Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/inmanta/protocol/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ class Client(Endpoint):

def __init__(self, name: str, timeout: int = 120) -> None:
super().__init__(name)
assert isinstance(timeout, int), "Timeout needs to be an integer value."
LOGGER.debug("Start transport for client %s", self.name)
self._transport_instance = client.RESTClient(self, connection_timout=timeout)

Expand Down Expand Up @@ -324,7 +325,7 @@ class SyncClient(object):
def __init__(self, name: str, timeout: int = 120) -> None:
self.name = name
self.timeout = timeout
self._client = Client(self.name)
self._client = Client(self.name, self.timeout)

def __getattr__(self, name: str) -> Callable:
def async_call(*args: List, **kwargs: Dict) -> None:
Expand Down
8 changes: 8 additions & 0 deletions tests/test_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,3 +320,11 @@ def test_method(name: str, value: int = 10):

assert call.call_args["name"] == "test"
assert call.call_args["value"] == 10


def test_create_client():
with pytest.raises(AssertionError):
protocol.SyncClient("agent", "120")

with pytest.raises(AssertionError):
protocol.Client("agent", "120")