Skip to content

Commit

Permalink
Merge branch 'feature/retry' into 'develop'
Browse files Browse the repository at this point in the history
Feature/retry

See merge request core/sevenbridges-python!73
  • Loading branch information
borislavd88 committed Nov 4, 2020
2 parents 5dd85bb + 7d8c580 commit 6892e1f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
9 changes: 4 additions & 5 deletions sevenbridges/models/compound/tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ def map_input_output(item, api):
data.update(
{k: item[k] for k in item if k not in ['path', 'basename']}
)
if _secondary_files:
data.update({
'_secondary_files': _secondary_files,
'fetched': True
})
data.update({
'_secondary_files': _secondary_files or None,
'fetched': True
})
return File(api=api, **data)
else:
return item
2 changes: 1 addition & 1 deletion sevenbridges/models/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def is_folder(self):

@property
def secondary_files(self):
if self._secondary_files:
if self.field('_secondary_files'):
return [
File(api=self._api, **data)
for data in self._secondary_files
Expand Down
10 changes: 6 additions & 4 deletions tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import faker
import pytest

from sevenbridges import File
from sevenbridges.errors import SbgError

generator = faker.Factory.create()
Expand Down Expand Up @@ -287,8 +286,11 @@ def test_secondary_files(api, given, verifier):
output_id = generator.uuid4()

file_ids = [generator.uuid4() for _ in range(total)]
files = [{'id': _id} for _id in file_ids]
output = {'id': output_id, '_secondary_files': files}
files = [{'path': _id} for _id in file_ids]
output = {'id': output_id,
'secondaryFiles': files,
'class': 'File',
'path': output_id}
task = {
'id': task_id,
'outputs': {'output': output}
Expand All @@ -298,7 +300,7 @@ def test_secondary_files(api, given, verifier):

# action
response = api.tasks.get(id=task_id)
secondary_files = File(**response.outputs['output']).secondary_files
secondary_files = response.outputs['output'].secondary_files

# verification
assert len(secondary_files) == total
Expand Down

0 comments on commit 6892e1f

Please sign in to comment.