def test_bad_get_netrc_login(): os.environ["NETRC"] = "tests/.netrc" assert str(get_netrc()) is not None from httpx import utils utils.NETRC_STATIC_FILES = () os.environ["NETRC"] = "wrongpath" assert utils.get_netrc() is None os.environ["NETRC"] = "" assert utils.get_netrc() is None
def test_get_netrc_login(): os.environ["NETRC"] = "tests/.netrc" netrc = get_netrc() assert netrc.authenticators("netrcexample.org") == ( "example-username", None, "example-password", )