Skip to content

Commit

Permalink
✅ Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
John Tobe committed Apr 3, 2019
1 parent 6d081c4 commit 2cefa94
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scale/job/configuration/data/job_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,6 @@ def create_output_workspace_dict(output_params, job_data, job_exe):
if config and (config.default_output_workspace or config.output_workspaces):
workspace_names_dict = {} # {Output name: workspace name}
# Do the new way, grabbing output workspaces from job configuration
config = job_exe.job.get_job_configuration()
for name in output_params:
if name in config.output_workspaces:
workspace_names_dict[name] = config.output_workspaces[name]
Expand All @@ -779,6 +778,8 @@ def create_output_workspace_dict(output_params, job_data, job_exe):
from storage.models import Workspace
workspace_mapping = {w.name: w.id for w in Workspace.objects.filter(name__in=workspace_names_dict.values())}
for output_name, workspace_name in workspace_names_dict.items():
if workspace_name not in workspace_mapping:
raise Exception('Workspace with name %s does not exist!' % workspace_name)
workspace_dict[output_name] = workspace_mapping[workspace_name]

return workspace_dict
2 changes: 2 additions & 0 deletions scale/job/test/configuration/data/test_job_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ def new_isfile(path):

job_exe = MagicMock()
job_exe.id = 1
job_exe.job.get_job_configuration().default_output_workspace = None
job_exe.job.get_job_configuration().output_workspaces = None
data = {'output_data': [{'name': 'Param1', 'workspace_id': 1},
{'name': 'Param2', 'workspace_id': 2}]}
file_path_1 = os.path.join('/path', '1', 'my_file.txt')
Expand Down

0 comments on commit 2cefa94

Please # to comment.