def testNotEmptyProxyHostname(self): result = soap.proxy_url("localhost") self.assertEqual('http://localhost', result) result = soap.proxy_url("localhost", "", "") self.assertEqual('http://localhost', result) result = soap.proxy_url("localhost", "user", "pass") self.assertEqual('http://*****:*****@localhost', result) result = soap.proxy_url("localhost", "user", "pass", 8080) self.assertEqual('http://*****:*****@localhost:8080', result) result = soap.proxy_url("localhost", "user", "pass", 80) self.assertEqual('http://*****:*****@localhost', result) result = soap.proxy_url("localhost", port=80) self.assertEqual('http://localhost', result) result = soap.proxy_url("localhost", port=8080) self.assertEqual('http://localhost:8080', result) result = soap.proxy_url("localhost", port=8080, scheme='http') self.assertEqual('http://localhost:8080', result) result = soap.proxy_url("localhost", port=3128, scheme='https') self.assertEqual('https://localhost:3128', result)
def call(): logging.basicConfig(stream=sys.stdout,level=logging.DEBUG) p = load_properties() proxy_url = soap.proxy_url(p[pconstant.PROXY_HOSTNAME], p[pconstant.PROXY_USERNAME], p[pconstant.PROXY_PASSWORD], p[pconstant.PROXY_PORT], p[pconstant.PROXY_SCHEME]) zclient = ZimbraClient(soap.soap_url(p[pconstant.HOSTNAME]), proxy_url=proxy_url) zclient.authenticate(p[pconstant.ACCOUNT_NAME], p[pconstant.PASSWORD]) return f(p, zclient)