def test_polymorphic_deserialization(valid_data):
    """Ensure a polymorphically deserialized designWorkflow looks sane."""
    workflow: DesignWorkflow = Workflow.build(valid_data)
    assert workflow.design_space_id == UUID(
        valid_data['config']['design_space_id'])
    assert workflow.processor_id == UUID(valid_data['config']['processor_id'])
    assert workflow.predictor_id == UUID(valid_data['config']['predictor_id'])
def test_serialization(valid_data, valid_serialization_output):
    """Ensure a serialized DesignWorkflow looks sane."""
    workflow: DesignWorkflow = Workflow.build(valid_data)
    serialized = workflow.dump()
    serialized['id'] = valid_data['id']
    # we can have extra fields in the output of `dump`
    # these support forwards and backwards compatibility
    for k in valid_serialization_output:
        assert serialized[k] == valid_serialization_output[k]
def test_serialization(valid_data, valid_serialization_output):
    """Ensure a serialized DesignWorkflow looks sane."""
    workflow: DesignWorkflow = Workflow.build(valid_data)
    serialized = workflow.dump()
    serialized['id'] = valid_data['id']
    assert serialized == valid_serialization_output
Exemple #4
0
def test_missing_module_type():
    with pytest.raises(ValueError):
        Workflow.build(dict(module_type='foo'))
Exemple #5
0
 def build(self, data: dict) -> Workflow:
     """Build an individual Workflow."""
     workflow = Workflow.build(data)
     workflow.session = self.session
     workflow.project_id = self.project_id
     return workflow