MCPcopy Index your code
hub / github.com/python/cpython / test_netscape_misc

Method test_netscape_misc

Lib/test/test_http_cookiejar.py:1904–1925  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1902 self.assertIn("name='foo1', value='bar'", repr(new_c))
1903
1904 def test_netscape_misc(self):
1905 # Some additional Netscape cookies tests.
1906 c = CookieJar()
1907 headers = []
1908 req = urllib.request.Request("http://foo.bar.acme.com/foo")
1909
1910 # Netscape allows a host part that contains dots
1911 headers.append("Set-Cookie: Customer=WILE_E_COYOTE; domain=.acme.com")
1912 res = FakeResponse(headers, "http://www.acme.com/foo")
1913 c.extract_cookies(res, req)
1914
1915 # and that the domain is the same as the host without adding a leading
1916 # dot to the domain. Should not quote even if strange chars are used
1917 # in the cookie value.
1918 headers.append("Set-Cookie: PART_NUMBER=3,4; domain=foo.bar.acme.com")
1919 res = FakeResponse(headers, "http://www.acme.com/foo")
1920 c.extract_cookies(res, req)
1921
1922 req = urllib.request.Request("http://foo.bar.acme.com/foo")
1923 c.add_cookie_header(req)
1924 self.assertIn("PART_NUMBER=3,4", req.get_header("Cookie"))
1925 self.assertIn("Customer=WILE_E_COYOTE",req.get_header("Cookie"))
1926
1927 def test_intranet_domains_2965(self):
1928 # Test handling of local intranet hostnames without a dot.

Callers

nothing calls this directly

Calls 7

extract_cookiesMethod · 0.95
add_cookie_headerMethod · 0.95
get_headerMethod · 0.95
CookieJarClass · 0.90
FakeResponseClass · 0.85
assertInMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected