aports/community/lua-http/fix-cookie-spec-test.patch
2021-10-27 04:17:32 +03:00

41 lines
2.4 KiB
Diff

From b6934d04a494a3d3014307507c25af4cca3f4f59 Mon Sep 17 00:00:00 2001
From: daurnimator <quae@daurnimator.com>
Date: Sun, 20 Jun 2021 00:24:45 +1000
Subject: [PATCH] spec/cookie_spec: bump timestamp in test
---
spec/cookie_spec.lua | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/spec/cookie_spec.lua b/spec/cookie_spec.lua
index d80c93e..b8866fd 100644
--- a/spec/cookie_spec.lua
+++ b/spec/cookie_spec.lua
@@ -26,7 +26,7 @@ describe("cookie module", function()
it(":get works", function()
local s = http_cookie.new_store()
assert.same(nil, s:get("mysite.com", "/", "lang"))
- local key, value, params = http_cookie.parse_setcookie("lang=en-US; Expires=Wed, 09 Jun 2021 10:18:14 GMT")
+ local key, value, params = http_cookie.parse_setcookie("lang=en-US; Expires=Wed, 09 Jun 2121 10:18:14 GMT")
assert(s:store("mysite.com", "/", true, true, nil, key, value, params))
assert.same("en-US", s:get("mysite.com", "/", "lang"))
assert.same(nil, s:get("other.com", "/", "lang"))
@@ -68,7 +68,7 @@ describe("cookie module", function()
s.time = function() return 1234567890 end -- set time to something before the expiry
-- in spec this is kept from previous example.
assert(s:store("example.com", "/", true, true, nil, http_cookie.parse_setcookie("SID=31d4d96e407aad42; Path=/; Secure; HttpOnly")))
- assert(s:store("example.com", "/", true, true, nil, http_cookie.parse_setcookie("lang=en-US; Expires=Wed, 09 Jun 2021 10:18:14 GMT")))
+ assert(s:store("example.com", "/", true, true, nil, http_cookie.parse_setcookie("lang=en-US; Expires=Wed, 09 Jun 2121 10:18:14 GMT")))
assert.same("SID=31d4d96e407aad42; lang=en-US", s:lookup("example.com", "/", true, true))
s.time = function() return 9234567890 end -- set time to something after the expiry
assert.same("SID=31d4d96e407aad42", s:lookup("example.com", "/", true, true))
@@ -251,7 +251,7 @@ describe("cookie module", function()
end)
it("cleans up", function()
local s = http_cookie.new_store()
- assert.truthy(s:store("example.com", "/", true, true, nil, http_cookie.parse_setcookie("foo=foo; Expires=Wed, 09 Jun 2021 10:18:14 GMT")))
+ assert.truthy(s:store("example.com", "/", true, true, nil, http_cookie.parse_setcookie("foo=foo; Expires=Wed, 09 Jun 2121 10:18:14 GMT")))
assert.same("foo", s:get("example.com", "/", "foo"))
s.time = function() return 9876543210 end -- set time to something after the expiry
s:clean()