def testProxyEnabled(self): up2date_cfg = {} up2date_cfg['enableProxy'] = True up2date_cfg['enableProxyAuth'] = False up2date_cfg['httpProxy'] = 'foobar.com:40' url = rhnplugin.get_proxy_url(up2date_cfg) self.assertNotEquals(None, url)
def testProxyNoAuth(self): up2date_cfg = {} up2date_cfg['enableProxy'] = True up2date_cfg['enableProxyAuth'] = False netloc = 'foobar.com:40' up2date_cfg['httpProxy'] = netloc expected_proxy = 'https://' + netloc url = rhnplugin.get_proxy_url(up2date_cfg) self.assertEquals(expected_proxy, url)
def testProxyAuthEnabled(self): up2date_cfg = {} up2date_cfg['enableProxy'] = True netloc = 'foobar.com:40' up2date_cfg['httpProxy'] = netloc up2date_cfg['enableProxyAuth'] = True user = '******' password = '******' up2date_cfg['proxyUser'] = user up2date_cfg['proxyPassword'] = password expected_proxy = 'https://' + user + ":" + password + '@' + netloc url = rhnplugin.get_proxy_url(up2date_cfg) self.assertEquals(expected_proxy, url)
def testProxyDisabled(self): up2date_cfg = {} up2date_cfg['enableProxy'] = False up2date_cfg['enableProxyAuth'] = False url = rhnplugin.get_proxy_url(up2date_cfg) self.assertEquals(None, url)