示例#1
0
 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)
示例#2
0
    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)
示例#3
0
文件: util.py 项目: vipod/pyzimbra
    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)