Skip to content

Commit c369452

Browse files
Ilija VukoticBenGalewsky
authored andcommitted
additional tests
1 parent 9cdb95c commit c369452

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

tests/servicex_did_finder_lib/test_servicex_did.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,48 @@ def test_put_file_add():
2828
assert submitted['file_size'] == 1024
2929

3030

31+
@responses.activate
32+
def test_put_file_add_bulk():
33+
responses.add(responses.PUT, 'http://servicex.org/files', status=206)
34+
sx = ServiceXAdapter("http://servicex.org")
35+
sx.put_file_add_bulk([{
36+
'paths': ['root://foo.bar.ROOT'],
37+
'adler32': '32',
38+
'file_size': 1024,
39+
'file_events': 3141
40+
}, {
41+
'paths': ['root://foo.bar1.ROOT'],
42+
'adler32': '33',
43+
'file_size': 1025,
44+
'file_events': 3142
45+
}])
46+
47+
assert len(responses.calls) == 1
48+
submitted = json.loads(responses.calls[0].request.body)
49+
assert submitted[0]['paths'][0] == 'root://foo.bar.ROOT'
50+
assert submitted[0]['adler32'] == '32'
51+
assert submitted[0]['file_events'] == 3141
52+
assert submitted[0]['file_size'] == 1024
53+
54+
assert submitted[0]['paths'][0] == 'root://foo.bar1.ROOT'
55+
assert submitted[0]['adler32'] == '33'
56+
assert submitted[0]['file_events'] == 3142
57+
assert submitted[0]['file_size'] == 1025
58+
59+
60+
@responses.activate
61+
def test_put_file_add_bulk_large():
62+
responses.add(responses.PUT, 'http://servicex.org/files', status=206)
63+
sx = ServiceXAdapter("http://servicex.org")
64+
sx.put_file_add_bulk([{
65+
'paths': ['root://foo.bar.ROOT'],
66+
'adler32': '32',
67+
'file_size': 1024,
68+
'file_events': 3141
69+
}] * 32)
70+
assert len(responses.calls) == 2
71+
72+
3173
@responses.activate
3274
def test_put_file_add_with_prefix():
3375
responses.add(responses.PUT, 'http://servicex.org/files', status=206)

0 commit comments

Comments
 (0)