Skip to content

Commit a60b683

Browse files
committed
Add unit testing of put_file_add
1 parent 65ce443 commit a60b683

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pytest = "^5.2"
1515
flake8 = "^3.9.1"
1616
pytest-mock = "^3.5.1"
1717
coverage = "^5.5"
18+
responses = "^0.14.0"
1819

1920
[build-system]
2021
requires = ["poetry-core>=1.0.0"]

tests/servicex_did_finder_lib/test_servicex_did.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,23 @@
33

44
def test_version():
55
assert __version__ == '1.0.0a1'
6+
7+
8+
@responses.activate
9+
def test_put_file_add():
10+
responses.add(responses.PUT, 'http://servicex.org/files', status=206)
11+
sx = ServiceXAdapter("http://servicex.org")
12+
sx.put_file_add({
13+
'file_path': 'root://foo.bar.ROOT',
14+
'adler32': '32',
15+
'file_size': 1024,
16+
'file_events': 3141
17+
})
18+
19+
assert len(responses.calls) == 1
20+
submitted = json.loads(responses.calls[0].request.body)
21+
assert submitted['file_path'] == 'root://foo.bar.ROOT'
22+
assert submitted['adler32'] == '32'
23+
assert submitted['file_events'] == 3141
24+
assert submitted['file_size'] == 1024
25+

0 commit comments

Comments
 (0)