From a1df2b764f2fb691c1b2c750e4d80c21b28986ec Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 15:12:06 -1000 Subject: Drive the auth actions through the harness run_action repeated harness.run line for line, and three comments only labelled the sections below them. --- tests/extensions/test-auth.lua | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/tests/extensions/test-auth.lua b/tests/extensions/test-auth.lua index a7e1b70..f9e3596 100644 --- a/tests/extensions/test-auth.lua +++ b/tests/extensions/test-auth.lua @@ -235,8 +235,6 @@ if variant == "file" then h.redirect_file("/etc/cgit-auth/groups", directory .. "/auth-groups") end --- The url and cookie helpers. - h.equals("decode handles escapes and plus", url_decode("%41+b"), "A b") h.equals("encode escapes what is not a word", url_encode("a b|c"), "a+b%7Cc") local tricky = "x&=?|" @@ -286,8 +284,6 @@ h.check("nor a relative path", not is_safe_redirect("x/y")) h.check("nor an empty target", not is_safe_redirect("")) h.check("a missing target is not", not is_safe_redirect(nil)) --- Signing and verification. - local now = os.time() local cookie = secure_value("username", "alice", now + 3600) @@ -357,8 +353,6 @@ h.equals("an exponent spelling of the expiry does not verify, even signed", validate_value("username", secure_value("username", "alice", "1e10")), nil) h.equals("an empty value signs to nothing", secure_value("username", "", 1), "") --- The headers the filter writes itself. - h.reset() set_cookie("cgitauth", "value") local out = h.output() @@ -385,15 +379,9 @@ h.excludes("no carriage return slips through", out, "\r") local function run_action(action, opts) opts = opts or {} - h.reset() - filter_open(action, opts.cookie or "", opts.method or "GET", "", "", + return h.run({ action, opts.cookie or "", opts.method or "GET", "", "", "/", "example.org", opts.https or "on", opts.repo or "", "summary", - opts.url or "/repo/", "/?p=login") - if opts.body then - filter_write(opts.body) - end - local ret = filter_close() - return h.output(), ret + opts.url or "/repo/", "/?p=login" }, { opts.body }) end -- A login posts the form, and a visit asks about a repository, with a -- cgit 2.12.1