Exemplo n.º 1
0
    def test_one(self):
        """
        Test one source.
        """

        source = TopoNode()
        source.save(self.manager)
        target = TopoNode()
        target.save(self.manager)
        edge = TopoEdge(sources=source.id, targets=target.id)
        edge.save(self.manager)

        check = _all(event={}, ctx={}, vertice=target, manager=self.manager)
        self.assertTrue(check)

        source.state = Check.MINOR
        source.save(self.manager)

        check = _all(event={}, ctx={}, vertice=target, manager=self.manager)
        self.assertFalse(check)
Exemplo n.º 2
0
    def test_many(self):

        target = TopoNode()
        target.save(self.manager)
        count = 5
        sources = [TopoNode() for i in range(count)]
        for source in sources:
            source.save(self.manager)
        edge = TopoEdge(
            sources=[source.id for source in sources], targets=target.id
        )
        edge.save(self.manager)

        check = _all(event={}, ctx={}, vertice=target, manager=self.manager)
        self.assertTrue(check)

        sources[0].state = Check.MINOR
        sources[0].save(self.manager)

        check = _all(event={}, ctx={}, vertice=target, manager=self.manager)
        self.assertFalse(check)