Exemple #1
0
    def test_basic_no_prune(self):
        inp1 = MockInputEvent(fingerprint="a")
        inp2 = MockInputEvent(fingerprint="b")
        int1 = MockInternalEvent(fingerprint="c")
        inp3 = MockInputEvent(fingerprint="d")
        events = [inp1, inp2, int1, inp3]

        def fake_find_internal_events(replay_dag, wait_time):
            if replay_dag.events == [inp1]:
                return []
            elif replay_dag.events == [inp1, inp2]:
                return [int1]
            elif replay_dag.events == [inp1, inp2, int1, inp3]:
                return []
            else:
                raise AssertionError("Unexpected event sequence queried: %s" %
                                     replay_dag.events)

        self.peeker.find_internal_events = fake_find_internal_events
        new_dag = self.peeker.peek(EventDag(events))
        self.assertEquals(events, new_dag.events)