From 9a1f64ed7e906403ab9dc2837a67c6bf9521ff8f Mon Sep 17 00:00:00 2001 From: Ilija Vukotic Date: Mon, 25 Sep 2023 18:33:42 -0500 Subject: [PATCH] fixed tests --- pyproject.toml | 9 +++++--- src/servicex_did_finder_lib/__init__.py | 2 +- .../test_communication.py | 3 ++- .../test_servicex_did.py | 22 ++++++++++--------- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index be87069..2539b76 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,13 +5,16 @@ description = "ServiceX DID Library Routines" authors = ["Gordon Watts "] [tool.poetry.dependencies] -python = "^3.6" +python = "^3.8" pika = "1.1.0" make-it-sync = "^1.0.0" requests = "^2.25.0" -[tool.poetry.dev-dependencies] -pytest = "^5.2" +[tool.poetry.group.dev] +optional = true + +[tool.poetry.group.dev.dependencies] +pytest = "^7.4" flake8 = "^3.9.1" pytest-mock = "^3.5.1" coverage = "^5.5" diff --git a/src/servicex_did_finder_lib/__init__.py b/src/servicex_did_finder_lib/__init__.py index be03fba..877c973 100644 --- a/src/servicex_did_finder_lib/__init__.py +++ b/src/servicex_did_finder_lib/__init__.py @@ -1,4 +1,4 @@ -__version__ = '1.0.0a1' +__version__ = '1.4.4' from .communication import start_did_finder, \ add_did_finder_cnd_arguments # NOQA diff --git a/tests/servicex_did_finder_lib/test_communication.py b/tests/servicex_did_finder_lib/test_communication.py index 709561f..8a56fc8 100644 --- a/tests/servicex_did_finder_lib/test_communication.py +++ b/tests/servicex_did_finder_lib/test_communication.py @@ -27,9 +27,10 @@ def send_did_request(self, did_name: str): properties = MagicMock() body = json.dumps( { + "request_id": '123-456', "did": did_name, "dataset_id": "000-111-222-444", - "service-endpoint": "http://localhost:2334", + "endpoint": "http://localhost:2334/", } ) diff --git a/tests/servicex_did_finder_lib/test_servicex_did.py b/tests/servicex_did_finder_lib/test_servicex_did.py index a272c6c..3ab61a9 100644 --- a/tests/servicex_did_finder_lib/test_servicex_did.py +++ b/tests/servicex_did_finder_lib/test_servicex_did.py @@ -6,13 +6,13 @@ def test_version(): - assert __version__ == '1.0.0a1' + assert __version__ == '1.4.4' @responses.activate def test_put_file_add(): - responses.add(responses.PUT, 'http://servicex.org/files', status=206) - sx = ServiceXAdapter("http://servicex.org") + responses.add(responses.PUT, 'http://servicex.org/12345/files', status=206) + sx = ServiceXAdapter("http://servicex.org/", '12345') sx.put_file_add({ 'paths': ['root://foo.bar.ROOT'], 'adler32': '32', @@ -30,8 +30,8 @@ def test_put_file_add(): @responses.activate def test_put_file_add_bulk(): - responses.add(responses.PUT, 'http://servicex.org/files', status=206) - sx = ServiceXAdapter("http://servicex.org") + responses.add(responses.PUT, 'http://servicex.org/12345/files', status=206) + sx = ServiceXAdapter("http://servicex.org/", '12345') sx.put_file_add_bulk([{ 'paths': ['root://foo.bar.ROOT'], 'adler32': '32', @@ -59,8 +59,8 @@ def test_put_file_add_bulk(): @responses.activate def test_put_file_add_bulk_large(): - responses.add(responses.PUT, 'http://servicex.org/files', status=206) - sx = ServiceXAdapter("http://servicex.org") + responses.add(responses.PUT, 'http://servicex.org/12345/files', status=206) + sx = ServiceXAdapter("http://servicex.org/", '12345') sx.put_file_add_bulk([{ 'paths': ['root://foo.bar.ROOT'], 'adler32': '32', @@ -72,8 +72,9 @@ def test_put_file_add_bulk_large(): @responses.activate def test_put_file_add_with_prefix(): - responses.add(responses.PUT, 'http://servicex.org/files', status=206) - sx = ServiceXAdapter("http://servicex.org", "xcache123:") + + responses.add(responses.PUT, 'http://servicex.org/12345/files', status=206) + sx = ServiceXAdapter("http://servicex.org/", '12345', file_prefix="xcache123:") sx.put_file_add({ 'paths': ['root://foo.bar.ROOT'], 'adler32': '32', @@ -95,6 +96,7 @@ def test_post_transform_start(): 'http://servicex.org/servicex/internal/transformation/123-456/start', status=206) - sx = ServiceXAdapter("http://servicex.org/servicex/internal/transformation/123-456") + sx = ServiceXAdapter( + "http://servicex.org/servicex/internal/transformation/", '12345', request_id='123-456') sx.post_transform_start() assert len(responses.calls) == 1