Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
    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
Exemplo n.º 3
0
    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
Exemplo n.º 4
0
    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
Exemplo n.º 5
0
    def test_constructor(self, sig_factory):
        sig = sig_factory.create()
        sig.freeze()

        node = WorkflowNode(sig)
        assert node.signature == sig
        assert node.dependencies == {}
        assert node.id == sig.id == 'task-1'
        sig.freeze.asset_called_once()
Exemplo n.º 6
0
 def test_constructor_not_frozen(self, sig_factory):
     sig = sig_factory.create(freeze=False)
     with pytest.raises(WorkflowException, match='not frozen'):
         WorkflowNode(sig)