Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ivukotic committed Sep 25, 2023
1 parent 882db62 commit 9a1f64e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ description = "ServiceX DID Library Routines"
authors = ["Gordon Watts <gwatts@uw.edu>"]

[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"
Expand Down
2 changes: 1 addition & 1 deletion src/servicex_did_finder_lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '1.0.0a1'
__version__ = '1.4.4'

from .communication import start_did_finder, \
add_did_finder_cnd_arguments # NOQA
3 changes: 2 additions & 1 deletion tests/servicex_did_finder_lib/test_communication.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
}
)

Expand Down
22 changes: 12 additions & 10 deletions tests/servicex_did_finder_lib/test_servicex_did.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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

0 comments on commit 9a1f64e

Please sign in to comment.