def test_get_sni_addr(self): from certbot_apache._internal.obj import Addr self.assertEqual(self.addr.get_sni_addr("443"), Addr.fromstring("*:443")) self.assertEqual(self.addr.get_sni_addr("225"), Addr.fromstring("*:225")) self.assertEqual(self.addr1.get_sni_addr("443"), Addr.fromstring("127.0.0.1"))
def setUp(self): from certbot_apache._internal.obj import Addr self.addr = Addr.fromstring("*:443") self.addr1 = Addr.fromstring("127.0.0.1") self.addr2 = Addr.fromstring("127.0.0.1:*") self.addr_defined = Addr.fromstring("127.0.0.1:443") self.addr_default = Addr.fromstring("_default_:443")
def setUp(self): from certbot_apache._internal.obj import Addr from certbot_apache._internal.obj import VirtualHost self.addr1 = Addr.fromstring("127.0.0.1") self.addr2 = Addr.fromstring("127.0.0.1:443") self.addr_default = Addr.fromstring("_default_:443") self.vhost1 = VirtualHost("filep", "vh_path", set([self.addr1]), False, False, "localhost") self.vhost1b = VirtualHost("filep", "vh_path", set([self.addr1]), False, False, "localhost") self.vhost2 = VirtualHost("fp", "vhp", set([self.addr2]), False, False, "localhost")
def test_conflicts(self): from certbot_apache._internal.obj import Addr from certbot_apache._internal.obj import VirtualHost complex_vh = VirtualHost( "fp", "vhp", set([Addr.fromstring("*:443"), Addr.fromstring("1.2.3.4:443")]), False, False) self.assertTrue(complex_vh.conflicts([self.addr1])) self.assertTrue(complex_vh.conflicts([self.addr2])) self.assertFalse(complex_vh.conflicts([self.addr_default])) self.assertTrue(self.vhost1.conflicts([self.addr2])) self.assertFalse(self.vhost1.conflicts([self.addr_default])) self.assertFalse(self.vhost2.conflicts([self.addr1, self.addr_default]))