def test_proxy(self): self.assertEqual(parse_proxy_string('http://*****:*****@foo:123'), (socks.HTTP, 'foo', 123, True, 'user', 'pass'))
def test_unsupported_proxy_type(self): with self.assertRaises(TelegramProxyError): parse_proxy_string('foo://*****:*****@foo:123')
def test_socks_import_error(self, m): with self.assertRaises(TelegramProxyError): parse_proxy_string('socks4://user:pass@foo:123')
def test_mtproxy(self): s = parse_proxy_string('mtproxy://secret@foo:123') self.assertEqual(s, ('mtproxy', 'foo', 123, 'secret'))
def test_malformed_url(self): with self.assertRaises(TelegramProxyError): parse_proxy_string('foo')
def test_none(self): self.assertIsNone(parse_proxy_string(None))