Esempio n. 1
0
    def test_false(self):
        """
        Test to check if there are at least one
        """

        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 = at_least(
            event={},
            ctx={},
            state=Check.MINOR,
            vertice=target,
            manager=self.manager
        )
        self.assertFalse(check)

        edge.weight = 0.5
        edge.save(self.manager)
        source.state = Check.MINOR
        source.save(self.manager)

        check = at_least(
            event={},
            ctx={},
            state=Check.MINOR,
            vertice=target,
            manager=self.manager
        )
        self.assertFalse(check)

        edge.weight = 1.5
        edge.save(self.manager)

        check = at_least(
            event={},
            ctx={},
            state=Check.MINOR,
            vertice=target,
            manager=self.manager
        )
        self.assertTrue(check)
Esempio n. 2
0
    def test_empty(self):
        """
        Test to process at least with no children.
        """

        target = TopoNode()
        target.save(self.manager)
        check = at_least(
            event={}, ctx={}, vertice=target, manager=self.manager
        )

        self.assertFalse(check)
Esempio n. 3
0
    def test_default(self):
        """
        Test to check default condition.
        """

        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 = at_least(
            event={}, ctx={}, vertice=target, manager=self.manager
        )

        self.assertTrue(check)