Ejemplo n.º 1
0
    def test_parse_ns_headers(self):
        from ClientCookie._HeadersUtil import parse_ns_headers

        # quotes should be stripped
        assert parse_ns_headers(['foo=bar; expires=01 Jan 2040 22:23:32 GMT']) == \
               [[('foo', 'bar'), ('expires', 2209069412L), ('version', '0')]]
        assert parse_ns_headers(['foo=bar; expires="01 Jan 2040 22:23:32 GMT"']) == \
               [[('foo', 'bar'), ('expires', 2209069412L), ('version', '0')]]
Ejemplo n.º 2
0
    def test_parse_ns_headers(self):
        from ClientCookie._HeadersUtil import parse_ns_headers

        # quotes should be stripped
        assert parse_ns_headers(['foo=bar; expires=01 Jan 2040 22:23:32 GMT']) == \
               [[('foo', 'bar'), ('expires', 2209069412L), ('version', '0')]]
        assert parse_ns_headers(['foo=bar; expires="01 Jan 2040 22:23:32 GMT"']) == \
               [[('foo', 'bar'), ('expires', 2209069412L), ('version', '0')]]
Ejemplo n.º 3
0
    def test_parse_ns_headers(self):
        from ClientCookie._HeadersUtil import parse_ns_headers

        # quotes should be stripped
        assert parse_ns_headers(["foo=bar; expires=01 Jan 2040 22:23:32 GMT"]) == [
            [("foo", "bar"), ("expires", 2209069412L), ("version", "0")]
        ]
        assert parse_ns_headers(['foo=bar; expires="01 Jan 2040 22:23:32 GMT"']) == [
            [("foo", "bar"), ("expires", 2209069412L), ("version", "0")]
        ]
Ejemplo n.º 4
0
    def test_parse_ns_headers_special_names(self):
        # names such as 'expires' are not special in first name=value pair
        # of Set-Cookie: header
        from ClientCookie._HeadersUtil import parse_ns_headers

        # Cookie with name 'expires'
        hdr = "expires=01 Jan 2040 22:23:32 GMT"
        expected = [[("expires", "01 Jan 2040 22:23:32 GMT"), ("version", "0")]]
        self.assertEquals(parse_ns_headers([hdr]), expected)
Ejemplo n.º 5
0
    def test_parse_ns_headers_special_names(self):
        # names such as 'expires' are not special in first name=value pair
        # of Set-Cookie: header
        from ClientCookie._HeadersUtil import parse_ns_headers

        # Cookie with name 'expires'
        hdr = 'expires=01 Jan 2040 22:23:32 GMT'
        expected = [[("expires", "01 Jan 2040 22:23:32 GMT"),
                     ("version", "0")]]
        self.assertEquals(parse_ns_headers([hdr]), expected)