Home / Function/ test_should_bypass_proxies_win_registry() — requests Function Reference

test_should_bypass_proxies_win_registry() — requests Function Reference

Architecture documentation for the test_should_bypass_proxies_win_registry() function in test_utils.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  b1b5f3cf_2566_3a15_c9d2_c1a344e8ad08["test_should_bypass_proxies_win_registry()"]
  5828793e_be5b_8952_37f1_338fd4634a1a["test_utils.py"]
  b1b5f3cf_2566_3a15_c9d2_c1a344e8ad08 -->|defined in| 5828793e_be5b_8952_37f1_338fd4634a1a
  1d6ec2dc_3200_1695_ca5e_059140ad2747["Close()"]
  b1b5f3cf_2566_3a15_c9d2_c1a344e8ad08 -->|calls| 1d6ec2dc_3200_1695_ca5e_059140ad2747
  style b1b5f3cf_2566_3a15_c9d2_c1a344e8ad08 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_utils.py lines 850–884

def test_should_bypass_proxies_win_registry(url, expected, override, monkeypatch):
    """Tests for function should_bypass_proxies to check if proxy
    can be bypassed or not with Windows registry settings
    """
    if override is None:
        override = "192.168.*;127.0.0.1;localhost.localdomain;172.16.1.1"
    import winreg

    class RegHandle:
        def Close(self):
            pass

    ie_settings = RegHandle()
    proxyEnableValues = deque([1, "1"])

    def OpenKey(key, subkey):
        return ie_settings

    def QueryValueEx(key, value_name):
        if key is ie_settings:
            if value_name == "ProxyEnable":
                # this could be a string (REG_SZ) or a 32-bit number (REG_DWORD)
                proxyEnableValues.rotate()
                return [proxyEnableValues[0]]
            elif value_name == "ProxyOverride":
                return [override]

    monkeypatch.setenv("http_proxy", "")
    monkeypatch.setenv("https_proxy", "")
    monkeypatch.setenv("ftp_proxy", "")
    monkeypatch.setenv("no_proxy", "")
    monkeypatch.setenv("NO_PROXY", "")
    monkeypatch.setattr(winreg, "OpenKey", OpenKey)
    monkeypatch.setattr(winreg, "QueryValueEx", QueryValueEx)
    assert should_bypass_proxies(url, None) == expected

Domain

Subdomains

Defined In

Calls

Frequently Asked Questions

What does test_should_bypass_proxies_win_registry() do?
test_should_bypass_proxies_win_registry() is a function in the requests codebase, defined in tests/test_utils.py.
Where is test_should_bypass_proxies_win_registry() defined?
test_should_bypass_proxies_win_registry() is defined in tests/test_utils.py at line 850.
What does test_should_bypass_proxies_win_registry() call?
test_should_bypass_proxies_win_registry() calls 1 function(s): Close.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free