コード例 #1
0
ファイル: test_proxy.py プロジェクト: winhamwr/pip
def test_remove_proxy():
    """
    Test removing proxy from environ.

    """
    if 'HTTP_PROXY' in os.environ:
        del os.environ['HTTP_PROXY']
    assert get_proxy() == None
    os.environ['HTTP_PROXY'] = 'user:[email protected]:port'
    assert get_proxy() == 'user:[email protected]:port'
    del os.environ['HTTP_PROXY']
    assert get_proxy('server.com') == 'server.com'
    assert get_proxy('server.com:80') == 'server.com:80'
    assert get_proxy('user:[email protected]:3128') == 'user:[email protected]:3128'
コード例 #2
0
ファイル: test_proxy.py プロジェクト: none-da/pip
def test_remove_proxy():
    """
    Test removing proxy from environ.

    """
    if "HTTP_PROXY" in os.environ:
        del os.environ["HTTP_PROXY"]
    assert get_proxy() == None
    os.environ["HTTP_PROXY"] = "user:[email protected]:port"
    assert get_proxy() == "user:[email protected]:port"
    del os.environ["HTTP_PROXY"]
    assert get_proxy("server.com") == "server.com"
    assert get_proxy("server.com:80") == "server.com:80"
    assert get_proxy("user:[email protected]:3128") == "user:[email protected]:3128"
コード例 #3
0
ファイル: test_proxy.py プロジェクト: dabrahams/pip
def test_remove_proxy():
    """
    Test removing proxy from environ.
    
    """
    if 'HTTP_PROXY' in os.environ:
        del os.environ['HTTP_PROXY']
    assert get_proxy() == None
    os.environ['HTTP_PROXY'] = 'user:[email protected]:port'
    assert get_proxy() == 'user:[email protected]:port'
    del os.environ['HTTP_PROXY']
    assert get_proxy('server.com') == 'server.com'
    assert get_proxy('server.com:80') == 'server.com:80'
    assert get_proxy('user:[email protected]:3128') == 'user:[email protected]:3128'
コード例 #4
0
ファイル: test_proxy.py プロジェクト: winhamwr/pip
def test_get_proxy():
    """
    Test get_proxy returns correct proxy info.

    """
    # monkeypatch getpass.getpass, to avoid asking for a password
    old_getpass = getpass.getpass
    getpass.getpass = new_getpass

    # Test it:
    assert get_proxy('user:@server.com:3128') == 'user:@server.com:3128'
    assert get_proxy('[email protected]:3128') == 'user:[email protected]:3128'

    # Undo monkeypatch
    getpass.getpass = old_getpass
コード例 #5
0
ファイル: test_proxy.py プロジェクト: none-da/pip
def test_get_proxy():
    """
    Test get_proxy returns correct proxy info.

    """
    # monkeypatch getpass.getpass, to avoid asking for a password
    old_getpass = getpass.getpass
    getpass.getpass = new_getpass

    # Test it:
    assert get_proxy("user:@server.com:3128") == "user:@server.com:3128"
    assert get_proxy("[email protected]:3128") == "user:[email protected]:3128"

    # Undo monkeypatch
    getpass.getpass = old_getpass