def test_deprecated_calls(collection: WorkflowExecutionCollection, workflow_execution, session): # When score = MLIScoreFactory() # triggering legacy Workflows has been removed with pytest.raises(NotImplementedError): actual_execution = collection.trigger(score) with pytest.raises(NotImplementedError): actual_execution = collection.update(workflow_execution) with pytest.raises(NotImplementedError): actual_execution = collection.register(workflow_execution)
def executions(self) -> WorkflowExecutionCollection: """Return a resource representing all visible executions of this workflow.""" if getattr(self, 'project_id', None) is None: raise AttributeError( 'Cannot initialize execution without project reference!') return WorkflowExecutionCollection(self.project_id, self.uid, self.session)
def test_trigger_workflow_execution(collection: WorkflowExecutionCollection, workflow_execution, session): # Given session.set_response(workflow_execution.dump()) # When score = MLIScoreFactory() actual_execution = collection.trigger(score) # Then assert actual_execution.uid == workflow_execution.uid expected_path = '/projects/{}/workflows/{}/executions'.format( collection.project_id, collection.workflow_id, ) assert session.last_call == FakeCall(method='POST', path=expected_path, json=score.dump())
def collection(session) -> WorkflowExecutionCollection: return WorkflowExecutionCollection( project_id=uuid.uuid4(), workflow_id=uuid.uuid4(), session=session, )