def test_multiple_matches(self): """ Return all matches. """ valid_cert_id_1 = FakeCertID() valid_cert_id_2 = FakeCertID() valid_cert_id_3 = FakeCertID() valid_id_1 = Fake_ID(valid_cert_id_1) valid_id_2 = Fake_ID(valid_cert_id_2) valid_id_3 = Fake_ID(valid_cert_id_3) rv = _find_matches( [ FakeCertID(), valid_cert_id_1, FakeCertID(), valid_cert_id_3, FakeCertID(), valid_cert_id_2, ], [valid_id_1, valid_id_2, valid_id_3], ) assert [ ServiceMatch(cert_pattern=valid_cert_id_1, service_id=valid_id_1), ServiceMatch(cert_pattern=valid_cert_id_2, service_id=valid_id_2), ServiceMatch(cert_pattern=valid_cert_id_3, service_id=valid_id_3), ] == rv
def test_multiple_matches(self): """ Return all matches. """ valid_cert_id_1 = FakeCertID() valid_cert_id_2 = FakeCertID() valid_cert_id_3 = FakeCertID() valid_id_1 = Fake_ID(valid_cert_id_1) valid_id_2 = Fake_ID(valid_cert_id_2) valid_id_3 = Fake_ID(valid_cert_id_3) rv = _find_matches([ FakeCertID(), valid_cert_id_1, FakeCertID(), valid_cert_id_3, FakeCertID(), valid_cert_id_2, ], [valid_id_1, valid_id_2, valid_id_3]) self.assertEqual( [ (valid_cert_id_1, valid_id_1,), (valid_cert_id_2, valid_id_2,), (valid_cert_id_3, valid_id_3,), ], rv )
def test_no_match(self): """ If no valid certificate ids are found, return an empty list. """ rv = _find_matches( [FakeCertID(), FakeCertID(), FakeCertID()], [Fake_ID(object())] ) assert [] == rv
def test_no_match(self): """ If no valid certificate ids are found, return an empty list. """ rv = _find_matches( [FakeCertID(), FakeCertID(), FakeCertID()], [Fake_ID(object())]) assert [] == rv
def test_one_match(self): """ If there's a match, return a tuple of the certificate id and the service id. """ valid_cert_id = FakeCertID() valid_id = Fake_ID(valid_cert_id) rv = _find_matches([FakeCertID(), valid_cert_id, FakeCertID()], [valid_id]) assert [ServiceMatch(cert_pattern=valid_cert_id, service_id=valid_id)] == rv
def test_one_match(self): """ If there's a match, return a tuple of the certificate id and the service id. """ valid_cert_id = FakeCertID() valid_id = Fake_ID(valid_cert_id) rv = _find_matches( [FakeCertID(), valid_cert_id, FakeCertID()], [valid_id] ) assert [ ServiceMatch(cert_pattern=valid_cert_id, service_id=valid_id) ] == rv
def test_one_match(self): """ If there's a match, return a tuple of the certificate id and the service id. """ valid_cert_id = FakeCertID() valid_id = Fake_ID(valid_cert_id) rv = _find_matches([ FakeCertID(), valid_cert_id, FakeCertID(), ], [valid_id]) self.assertEqual( [(valid_cert_id, valid_id,)], rv )