Home / Class/ TestGetNetrcAuth Class — requests Architecture

TestGetNetrcAuth Class — requests Architecture

Architecture documentation for the TestGetNetrcAuth class in test_utils.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  23480515_8a49_da54_fb28_99055856000a["TestGetNetrcAuth"]
  5828793e_be5b_8952_37f1_338fd4634a1a["test_utils.py"]
  23480515_8a49_da54_fb28_99055856000a -->|defined in| 5828793e_be5b_8952_37f1_338fd4634a1a
  90cc1e7c_08c0_b279_7ff6_5c4cda0854ce["test_works()"]
  23480515_8a49_da54_fb28_99055856000a -->|method| 90cc1e7c_08c0_b279_7ff6_5c4cda0854ce
  bf998f54_2c7b_49af_b0a0_21c886894ef2["test_not_vulnerable_to_bad_url_parsing()"]
  23480515_8a49_da54_fb28_99055856000a -->|method| bf998f54_2c7b_49af_b0a0_21c886894ef2

Relationship Graph

Source Code

tests/test_utils.py lines 156–171

class TestGetNetrcAuth:
    def test_works(self, tmp_path, monkeypatch):
        netrc_path = tmp_path / ".netrc"
        monkeypatch.setenv("NETRC", str(netrc_path))
        with open(netrc_path, "w") as f:
            f.write("machine example.com login aaaa password bbbb\n")
        auth = get_netrc_auth("http://example.com/thing")
        assert auth == ("aaaa", "bbbb")

    def test_not_vulnerable_to_bad_url_parsing(self, tmp_path, monkeypatch):
        netrc_path = tmp_path / ".netrc"
        monkeypatch.setenv("NETRC", str(netrc_path))
        with open(netrc_path, "w") as f:
            f.write("machine example.com login aaaa password bbbb\n")
        auth = get_netrc_auth("http://example.com:@evil.com/'")
        assert auth is None

Domain

Defined In

Frequently Asked Questions

What is the TestGetNetrcAuth class?
TestGetNetrcAuth is a class in the requests codebase, defined in tests/test_utils.py.
Where is TestGetNetrcAuth defined?
TestGetNetrcAuth is defined in tests/test_utils.py at line 156.

Analyze Your Own Codebase

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

Try Supermodel Free