Browse Source

Merge pull request #1417 from romanz/tests

test_interface: fix check_host_name test
283
ThomasV 9 years ago
parent
commit
658a350a47
  1. 14
      lib/tests/test_interface.py

14
lib/tests/test_interface.py

@ -13,12 +13,14 @@ class TestInterface(unittest.TestCase):
self.assertFalse(interface._match_hostname('asd.fgh.com', '*.zxc.com'))
def test_check_host_name(self):
self.assertFalse(interface.check_host_name(None, None))
self.assertFalse(interface.check_host_name(
i = interface.TcpConnection(server=':1:', queue=None, config_path=None)
self.assertFalse(i.check_host_name(None, None))
self.assertFalse(i.check_host_name(
peercert={'subjectAltName': []}, name=''))
self.assertTrue(interface.check_host_name(
peercert={'subjectAltName': [('DNS', '*.bar.com')]},
self.assertTrue(i.check_host_name(
peercert={'subjectAltName': [('DNS', 'foo.bar.com')]},
name='foo.bar.com'))
self.assertTrue(interface.check_host_name(
peercert={'subject': [('commonName', '*.bar.com')]},
self.assertTrue(i.check_host_name(
peercert={'subject': [('commonName', 'foo.bar.com')]},
name='foo.bar.com'))

Loading…
Cancel
Save