Skip to content

Commit

Permalink
Add unit testing of put_file_add
Browse files Browse the repository at this point in the history
  • Loading branch information
BenGalewsky committed Oct 19, 2021
1 parent 773e4d6 commit 7010224
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pytest = "^5.2"
flake8 = "^3.9.1"
pytest-mock = "^3.5.1"
coverage = "^5.5"
responses = "^0.14.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
20 changes: 20 additions & 0 deletions tests/servicex_did_finder_lib/test_servicex_did.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,23 @@

def test_version():
assert __version__ == '1.0.0a1'


@responses.activate
def test_put_file_add():
responses.add(responses.PUT, 'http://servicex.org/files', status=206)
sx = ServiceXAdapter("http://servicex.org")
sx.put_file_add({
'file_path': 'root://foo.bar.ROOT',
'adler32': '32',
'file_size': 1024,
'file_events': 3141
})

assert len(responses.calls) == 1
submitted = json.loads(responses.calls[0].request.body)
assert submitted['file_path'] == 'root://foo.bar.ROOT'
assert submitted['adler32'] == '32'
assert submitted['file_events'] == 3141
assert submitted['file_size'] == 1024

0 comments on commit 7010224

Please sign in to comment.