Add a log in the mock environment

Add a function that implements `log()` in the mock environment.
This commit is contained in:
Robin Malley 2021-09-11 21:45:29 +00:00
parent e0a8e01513
commit ffc34295e9
1 changed files with 2 additions and 1 deletions

View File

@ -105,7 +105,7 @@ local smr_mock_env = {
return req.cookies[cookie_name]
end),
http_response_cookie = spy.new(function(req,name,value) req.cookies = {[name] = value} end),
log = spy.new(function(priority, message) end),
log = spy.new(function(priority, message) --[[print(string.format("[LOG %q]: %s",priority,message))]] end),
sha3 = spy.new(function(message) return "digest" end),
}
@ -161,6 +161,7 @@ function mock.mockdb()
local config = require("config")
config.db = "data/unittest.db"
assert(os.execute("rm " .. config.db))
package.loaded.db = nil
local db = require("db")
end