Merge branch 'master' into 6260-test-datamanager
[arvados.git] / sdk / python / tests / manifest_examples.py
1 import arvados
2 import arvados_testutil as tutil
3 import hashlib
4
5 class ManifestExamples(object):
6     def make_manifest(self,
7                       bytes_per_block=1,
8                       blocks_per_file=1,
9                       files_per_stream=1,
10                       streams=1):
11         datablip = 'x' * bytes_per_block
12         data_loc = '{}+{}'.format(hashlib.md5(datablip).hexdigest(),
13                                   bytes_per_block)
14         with tutil.mock_keep_responses(data_loc, 200):
15             coll = arvados.CollectionWriter()
16             for si in range(0, streams):
17                 for fi in range(0, files_per_stream):
18                     with coll.open("stream{}/file{}.txt".format(si, fi)) as f:
19                         for bi in range(0, blocks_per_file):
20                             f.write(datablip)
21             return coll.manifest_text()