def test_add_dependency_already_added(self, sig_factory): s1 = sig_factory.create() s2 = sig_factory.create() n1 = WorkflowNode(s1) n2 = WorkflowNode(s2) n1.add_dependency(n2) with pytest.raises(WorkflowException, match='already added'): n1.add_dependency(n2)
def test_add_dependency(self, sig_factory): s1 = sig_factory.create() s2 = sig_factory.create() n1 = WorkflowNode(s1) n2 = WorkflowNode(s2) n1.add_dependency(n2) assert n1.dependencies assert n2.id in n1.dependencies
def test_to_dict(self, sig_factory): w1 = WorkflowNode(sig_factory.create()) w2 = WorkflowNode(sig_factory.create()) w3 = WorkflowNode(sig_factory.create()) w1.add_dependency(w2) w1.add_dependency(w3) d = w1.to_dict() assert d['id'] == 'task-1' assert d['dependencies'] assert d['dependencies']['task-2'] is None assert d['dependencies']['task-3'] is None assert d['signature'] is w1.signature
def test_to_dict(self, sig_factory): w1 = WorkflowNode(sig_factory.create()) w2 = WorkflowNode(sig_factory.create()) w3 = WorkflowNode(sig_factory.create()) w1.add_dependency(w2) w1.add_dependency(w3) w1.custom_payload["foo"] = "bar" d = w1.to_dict() assert d['id'] == 'task-1' assert d['dependencies'] assert d['dependencies']['task-2'] is None assert d['dependencies']['task-3'] is None assert d['custom_payload']['foo'] == "bar" assert d['signature'] is w1.signature