add test suite
This commit is contained in:
parent
06924d10f6
commit
5d21c975ea
5 changed files with 160 additions and 45 deletions
23
tests/webfinger_allowlist.lua
Normal file
23
tests/webfinger_allowlist.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
TestWebfinger = {}
|
||||
|
||||
function TestWebfinger:setup()
|
||||
self.mod = setupTest('scripts.webfinger_allowlist', {accounts = {'correct@example.org'}})
|
||||
end
|
||||
|
||||
local WEBFINGER_PATH = '/.well-known/webfinger'
|
||||
|
||||
function TestWebfinger:testCorrectAccount()
|
||||
setupFakeRequest(WEBFINGER_PATH, { params = {resource = 'acct:correct@example.org'} })
|
||||
onRequest()
|
||||
lu.assertIs(ngx.status, nil)
|
||||
end
|
||||
|
||||
function TestWebfinger:testWrongAccount()
|
||||
setupFakeRequest(WEBFINGER_PATH, { params = {resource = 'acct:wrong@example.org'} })
|
||||
onRequest()
|
||||
lu.assertIs(ngx.status, 404)
|
||||
end
|
||||
|
||||
function TestWebfinger:teardown()
|
||||
teardownNgx()
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue