Beispiel #1
0
 def test_matches(self):
     """
     Valid matches return `True`.
     """
     for cert, actual in [
         (b"www.example.com", b"www.example.com"),
         (b"*.example.com", b"www.example.com"),
     ]:
         assert _hostname_matches(cert, actual)
Beispiel #2
0
 def test_matches(self):
     """
     Valid matches return `True`.
     """
     for cert, actual in [
         (b"www.example.com", b"www.example.com"),
         (b"*.example.com", b"www.example.com"),
     ]:
         assert _hostname_matches(cert, actual)
Beispiel #3
0
 def test_mismatches(self):
     """
     Invalid matches return `False`.
     """
     for cert, actual in [
         (b"xxx.example.com", b"www.example.com"),
         (b"*.example.com", b"baa.foo.example.com"),
         (b"f*.example.com", b"baa.example.com"),
         (b"*.bar.com", b"foo.baz.com"),
         (b"*.bar.com", b"bar.com"),
         (b"x*.example.com", b"xn--gtter-jua.example.com"),
     ]:
         assert not _hostname_matches(cert, actual)
Beispiel #4
0
 def test_matches(self):
     """
     Valid matches return `True`.
     """
     for cert, actual in [
         (b"www.example.com", b"www.example.com"),
         (b"*.example.com", b"www.example.com"),
         (b"xxx*.example.com", b"xxxwww.example.com"),
         (b"f*.example.com", b"foo.example.com"),
         (b"*oo.bar.com", b"foo.bar.com"),
         (b"fo*oo.bar.com", b"fooooo.bar.com"),
     ]:
         self.assertTrue(
             _hostname_matches(cert, actual)
         )