Diff options
Diffstat (limited to '')
| -rw-r--r-- | tests/extensions/harness.lua | 38 |
1 file changed, 6 insertions, 32 deletions
diff --git a/tests/extensions/harness.lua b/tests/extensions/harness.lua index 3df4719..2fe722f 100644 --- a/tests/extensions/harness.lua +++ b/tests/extensions/harness.lua @@ -54,18 +54,6 @@ html_url_path = sink(function(s) end)) end) --- No shipped extension calls the remaining sinks, so rather than risk an --- unfaithful copy quietly passing a test, using one fails loudly until its --- escaping is mirrored from source/html.c the way the ones above are. -local function unmirrored(name) - return function() - error(name .. " is not mirrored by the test harness yet") - end -end - -html_url_arg = unmirrored("html_url_arg") -html_include = unmirrored("html_include") - function harness.reset() pieces = {} end @@ -113,7 +101,7 @@ end -- Loaders registered here win over any real module on the package path, so a -- test can hand a script a deterministic stand-in, or with a failing loader -- prove the script's fallback for a module that is not installed. -function harness.preload(name, module) +local function preload(name, module) package.preload[name] = function() return module end @@ -164,7 +152,7 @@ end -- The slice of the luaossl digest interface the avatar filters use. function harness.stub_digest() - harness.preload("openssl.digest", { + preload("openssl.digest", { new = function(algorithm) return { final = function(self, text) @@ -188,27 +176,13 @@ local function fake_crypt(password, setting) return prefix .. password end --- The slices of luaossl and luaposix the auth filters use. The link and --- unlink stubs serve the secret creation path, which the auth checks bypass --- by replacing get_secret, so they only have to exist. +-- The slices of luaossl and luaposix the auth checks reach. function harness.stub_auth_modules() local rand_counter = 0 - harness.preload("posix.sys.stat", { - umask = function(mask) - return 18 - end, - }) - harness.preload("posix.unistd", { + preload("posix.unistd", { crypt = fake_crypt, - link = function(from, to) - return nil - end, - unlink = function(path) - os.remove(path) - return 0 - end, }) - harness.preload("openssl.rand", { + preload("openssl.rand", { bytes = function(count) local out = {} for i = 1, count do @@ -218,7 +192,7 @@ function harness.stub_auth_modules() return table.concat(out) end, }) - harness.preload("openssl.hmac", { + preload("openssl.hmac", { new = function(key, algorithm) return { final = function(self, payload) |
