fixing some failing test
This commit is contained in:
parent
4f2602c2f8
commit
7a99859108
|
@ -36,7 +36,9 @@ def all_specifications(libraries=False,standalone=False):
|
|||
|
||||
# return standard workflows (not library, not standalone)
|
||||
specs = spec_service.get_specs()
|
||||
specs.append(spec_service.get_master_spec())
|
||||
master_spec = spec_service.get_master_spec()
|
||||
if master_spec:
|
||||
specs.append(spec_service.get_master_spec())
|
||||
return WorkflowSpecInfoSchema(many=True).dump(specs)
|
||||
|
||||
|
||||
|
|
|
@ -211,8 +211,6 @@ class Study(object):
|
|||
|
||||
@classmethod
|
||||
def from_model(cls, study_model: StudyModel):
|
||||
if not isinstance(study_model, StudyModel):
|
||||
raise ApiError("Please don't call me with something other than StudyModel")
|
||||
if study_model is not None and len(study_model.__dict__.items()) > 0:
|
||||
args = dict((k, v) for k, v in study_model.__dict__.items() if not k.startswith('_'))
|
||||
args['events_history'] = study_model.events_history # For some reason this attribute is not picked up
|
||||
|
|
|
@ -55,14 +55,15 @@ class WorkflowSpecService(FileSystemService):
|
|||
|
||||
def get_master_spec(self):
|
||||
path = os.path.join(FileSystemService.root_path(), FileSystemService.MASTER_SPECIFICATION)
|
||||
return self.__scan_spec(path, FileSystemService.MASTER_SPECIFICATION)
|
||||
if os.path.exists(path):
|
||||
return self.__scan_spec(path, FileSystemService.MASTER_SPECIFICATION)
|
||||
|
||||
def get_spec(self, spec_id):
|
||||
if not os.path.exists(FileSystemService.root_path()):
|
||||
return # Nothing to scan yet. There are no files.
|
||||
|
||||
master_spec = self.get_master_spec()
|
||||
if master_spec.id == spec_id:
|
||||
if master_spec and master_spec.id == spec_id:
|
||||
return master_spec
|
||||
with os.scandir(FileSystemService.root_path()) as category_dirs:
|
||||
for item in category_dirs:
|
||||
|
|
|
@ -21,7 +21,7 @@ class TestWorkflowSpec(BaseTest):
|
|||
content_type="application/json",headers=self.logged_in_headers())
|
||||
self.assert_success(rv)
|
||||
json_data = json.loads(rv.get_data(as_text=True))
|
||||
specs = WorkflowSpecInfoSchema(many=True).load(json_data)
|
||||
specs = WorkflowSpecInfoSchema(many=True).load(json_data, partial=True)
|
||||
spec2 = specs[0]
|
||||
self.assertEqual(spec.id, spec2.id)
|
||||
self.assertEqual(spec.display_name, spec2.display_name)
|
||||
|
|
Loading…
Reference in New Issue