Exemple #1
0
    def test_do_not_override_with_none(self):
        a = HeuristicA()
        b = HeuristicB()

        h = Heuristics()
        h.add_multiple([a, b])
        self.assertEqual(a.engine_set, "NO")
        self.assertEqual(b.kb_set, "NO")
Exemple #2
0
    def test_assign_engine_and_kb_on_heuristics(self):
        a = HeuristicA()
        b = HeuristicB()

        h = Heuristics(request_engine="X", kb="Y")
        h.add_multiple([a, b])
        self.assertEqual(a.engine_set, "X")
        self.assertEqual(b.kb_set, "Y")
Exemple #3
0
    def test_load_multiple_heuristics(self):
        a = HeuristicA()
        b = HeuristicB()

        h = Heuristics()
        h.add_multiple([a, b])
        self.assertEqual(len(h.rulesets["before_request"]), 2)
        self.assertEqual(len(h.rulesets["after_headers"]), 1)
        self.assertEqual(len(h.rulesets["after_response"]), 1)
        self.assertEqual(h.rulesets["before_request"].accept, h.before_request)