From 2da935da340915d6500e24cd6c39fd6c66a93de7 Mon Sep 17 00:00:00 2001 From: Hugo Cachitas Date: Wed, 3 Apr 2024 02:11:52 +0100 Subject: [PATCH] Fix version endpoint --- src/stringx/client.py | 11 ++++------- tests/test_client.py | 16 +++++++++------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/stringx/client.py b/src/stringx/client.py index 620f445..0bc5c3e 100644 --- a/src/stringx/client.py +++ b/src/stringx/client.py @@ -90,10 +90,7 @@ def interaction_partners( return self.request("interaction_partners", params=params) - def version(self): - print(self.params) - self.params = {} - request = self.build_request("GET", "https://api.example.com") - del request.headers["X-Api-Key"] - - return self.request("version", params={}) + def version(self) -> str: + request = self.build_request("GET", "api/json/version") + request.url = request.url.copy_remove_param("caller_identity") + return self.send(request).json() diff --git a/tests/test_client.py b/tests/test_client.py index 0e5efeb..9b66756 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -119,12 +119,14 @@ def test_interaction_partners(httpx_mock): def test_version(httpx_mock): httpx_mock.add_response( - url=httpx.URL("https://string-db.org/api/json/version"), method="POST", json={} + url=httpx.URL("https://string-db.org/api/json/version"), + method="GET", + json=[ + { + "string_version": "12.0", + "stable_address": "https://version-12-0.string-db.org", + } + ], ) with stringx.Client() as client: - version = client.version() - version = client.map(["edin"], species=7227) - version = client.version() - - print(version) - assert version == "" + client.version()