(self)
| 1951 | self.assertEqual(len(c), 2) |
| 1952 | |
| 1953 | def test_empty_path(self): |
| 1954 | # Test for empty path |
| 1955 | # Broken web-server ORION/1.3.38 returns to the client response like |
| 1956 | # |
| 1957 | # Set-Cookie: JSESSIONID=ABCDERANDOM123; Path= |
| 1958 | # |
| 1959 | # ie. with Path set to nothing. |
| 1960 | # In this case, extract_cookies() must set cookie to / (root) |
| 1961 | c = CookieJar(DefaultCookiePolicy(rfc2965 = True)) |
| 1962 | headers = [] |
| 1963 | |
| 1964 | req = urllib.request.Request("http://www.ants.com/") |
| 1965 | headers.append("Set-Cookie: JSESSIONID=ABCDERANDOM123; Path=") |
| 1966 | res = FakeResponse(headers, "http://www.ants.com/") |
| 1967 | c.extract_cookies(res, req) |
| 1968 | |
| 1969 | req = urllib.request.Request("http://www.ants.com/") |
| 1970 | c.add_cookie_header(req) |
| 1971 | |
| 1972 | self.assertEqual(req.get_header("Cookie"), |
| 1973 | "JSESSIONID=ABCDERANDOM123") |
| 1974 | self.assertEqual(req.get_header("Cookie2"), '$Version="1"') |
| 1975 | |
| 1976 | # missing path in the request URI |
| 1977 | req = urllib.request.Request("http://www.ants.com:8080") |
| 1978 | c.add_cookie_header(req) |
| 1979 | |
| 1980 | self.assertEqual(req.get_header("Cookie"), |
| 1981 | "JSESSIONID=ABCDERANDOM123") |
| 1982 | self.assertEqual(req.get_header("Cookie2"), '$Version="1"') |
| 1983 | |
| 1984 | def test_session_cookies(self): |
| 1985 | year_plus_one = time.localtime()[0] + 1 |
nothing calls this directly
no test coverage detected