From 534fb110971616f2d1e589454a5881d765673d80 Mon Sep 17 00:00:00 2001 From: Mads Bisgaard <126242332+bisgaard-itis@users.noreply.github.com> Date: Mon, 18 Nov 2024 14:29:19 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20searchfile=20bug=20and=20f?= =?UTF-8?q?ilter=20tests=20for=20old=20clients=20(#218)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- clients/python/src/osparc/_api_files_api.py | 10 +++++++--- clients/python/test/e2e/test_files_api.py | 7 ++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/clients/python/src/osparc/_api_files_api.py b/clients/python/src/osparc/_api_files_api.py index 1eb24f5a..f3ad25b3 100644 --- a/clients/python/src/osparc/_api_files_api.py +++ b/clients/python/src/osparc/_api_files_api.py @@ -251,11 +251,15 @@ def _search_files( sha256_checksum: Optional[str] = None, timeout_seconds: int = DEFAULT_TIMEOUT_SECONDS, ) -> PaginationGenerator: + kwargs = { + "file_id": file_id, + "sha256_checksum": sha256_checksum, + "_request_timeout": timeout_seconds, + } + def _pagination_method(): return super(FilesApi, self).search_files_page( - file_id=file_id, - sha256_checksum=sha256_checksum, - _request_timeout=timeout_seconds, + **{k: v for k, v in kwargs.items() if v is not None} ) return PaginationGenerator( diff --git a/clients/python/test/e2e/test_files_api.py b/clients/python/test/e2e/test_files_api.py index 5a292a2c..3b6675f7 100644 --- a/clients/python/test/e2e/test_files_api.py +++ b/clients/python/test/e2e/test_files_api.py @@ -85,9 +85,10 @@ def max_diff(data: List[int]) -> int: assert _hash_file(Path(downloaded_file)) == _hash_file(large_server_file.local_file) -@skip_if_osparc_version(at_least=Version("0.8.0")) -@pytest.mark.parametrize("use_checksum", [True, False]) -@pytest.mark.parametrize("use_id", [True, False]) +@skip_if_osparc_version(at_least=Version("0.8.3.post0.dev20")) +@pytest.mark.parametrize( + "use_checksum,use_id", [(True, True), (False, True), (True, False)] +) def test_search_files( large_server_file: Callable[[ByteSize], Path], files_api: osparc.FilesApi,