def __init__(self): self.cfg = config.initUp2dateConfig() self.xmlrpcServerUrl = self.cfg["serverURL"] refreshServerList = 0 if self.cfg["useNoSSLForPackages"]: self.httpServerUrls = self.cfg["noSSLServerURL"] refreshServerList = 1 else: self.httpServerUrls = self.cfg["serverURL"] if type(self.httpServerUrls) == type(""): self.httpServerUrls = [self.httpServerUrls] self.serverList = rpcServer.initServerList(self.httpServerUrls) # if the list of servers for packages and stuff is different, # refresh if refreshServerList: self.serverList.resetServerList(self.httpServerUrls) self.proxyUrl = None self.proxyUser = None self.proxyPassword = None if self.cfg["enableProxy"] and up2dateUtils.getProxySetting(): self.proxyUrl = up2dateUtils.getProxySetting() if self.cfg["enableProxyAuth"]: if self.cfg["proxyUser"] and self.cfg["proxyPassword"]: self.proxyPassword = self.cfg["proxyPassword"] self.proxyUser = self.cfg["proxyUser"]
def testHttpUnSpecified(self): "Verify that proxies with no http:// work correctly" self.cfg['httpProxy'] = self.proxy2 res = up2dateUtils.getProxySetting() assert res == "proxy.company.com:8080"
def testHttpSpecified(self): "Verify that http:// gets stripped from proxy settings" self.cfg['httpProxy'] = self.proxy1 res = up2dateUtils.getProxySetting() assert res == "proxy.company.com:8080"