Beispiel #1
0
    def test_potential_hit(self):
        self.misuses.append(create_misuse("-m1-"))
        finding = Finding({"rank": ":potential hit for m1:"})
        finding.is_potential_hit = lambda misuse, y: misuse == self.misuses[0]

        potential_hits = self.uut.get_potential_hits([finding])

        assert_equals(self.misuses[0].id, potential_hits[0]["misuse"])
Beispiel #2
0
    def test_potential_hit_for_second_misuse(self):
        self.misuses.extend([create_misuse("-1st-"), create_misuse("-2nd-")])
        finding = Finding({"rank": ":some potential hit for second misuse:"})
        finding.is_potential_hit = lambda misuse, y: misuse == self.misuses[1]

        potential_hits = self.uut.get_potential_hits([finding])

        assert_equals(self.misuses[1].id, potential_hits[0]["misuse"])
Beispiel #3
0
    def test_no_hit(self):
        self.misuses.append(create_misuse("-m1-"))
        finding = Finding({"rank": "no potential hit"})
        finding.is_potential_hit = lambda misuse, y: False

        potential_hits = self.uut.get_potential_hits([finding])

        assert_equals([], potential_hits)