def test_crate12_psql(self): self.assertEqual(AddrConsumer._parse(crate12_psql), ('psql', '127.0.0.1:5432')) self.assertEqual(AddrConsumer._parse(crate12_http), ('http', '127.0.0.1:4200')) self.assertEqual(AddrConsumer._parse(crate12_transport), ('transport', '127.0.0.1:4300'))
def test_ipv6_psql(self): self.assertEqual(AddrConsumer._parse(ipv6_psql), ('psql', '[::1]:5432'))
def test_ipv6_http(self): self.assertEqual(AddrConsumer._parse(ipv6_http), ('http', '[::1]:44200'))
def get_match(lines): for line in lines: protocol, addr = AddrConsumer._parse(line) if protocol: return protocol, addr