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] return req.cookies[cookie_name]
end), end),
http_response_cookie = spy.new(function(req,name,value) req.cookies = {[name] = value} 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), sha3 = spy.new(function(message) return "digest" end),
} }
@ -161,6 +161,7 @@ function mock.mockdb()
local config = require("config") local config = require("config")
config.db = "data/unittest.db" config.db = "data/unittest.db"
assert(os.execute("rm " .. config.db)) assert(os.execute("rm " .. config.db))
package.loaded.db = nil
local db = require("db") local db = require("db")
end end