Пример #1
0
    def test_does_not_reach_max_hops1(self):
        """Request does not expire with non-default value after a few dispatches"""
        r = Request(id=1, dispatcher=lambda o: o, args=1, hop_limit=5)

        for _ in range(3):
            r.dispatch()

        self.assertFalse(r.expired())
Пример #2
0
    def test_reaches_max_hops1(self):
        """Request expires with non-default value after appropriate amount of time"""
        r = Request(id=1, dispatcher=lambda o: o, args=1, hop_limit=5)

        for _ in range(5):
            r.dispatch()

        self.assertTrue(r.expired())
Пример #3
0
    def test_does_not_reach_max_hops0(self):
        """Request does not expire with default value after no dispatches"""
        r = Request(id=1, dispatcher=lambda o: o, args=1, hop_limit=5)

        self.assertFalse(r.expired())
Пример #4
0
    def test_reaches_max_hops(self):
        """Request exipires by default after one dispatch"""
        r = Request(id=1, dispatcher=lambda o: o, args=1)
        r.dispatch()

        self.assertTrue(r.expired())