1
0
Fork 0
forgejo/modules
wxiaoguang 819aed35bf
Make route middleware/handler mockable (#25766)
To mock a handler:

```go
web.RouteMock(web.MockAfterMiddlewares, func(ctx *context.Context) {
	// ...
})
defer web.RouteMockReset()
```


It helps:

* Test the middleware's behavior (assert the ctx.Data, etc)
* Mock the middleware's behavior (prepare some context data for handler)
* Mock the handler's response for some test cases, especially for some
integration tests and e2e tests.
2023-07-09 12:25:53 +00:00
..
actions Fix ref for workflows triggered by pull_request_target (#25743) 2023-07-07 19:22:03 +00:00
activitypub Update tool dependencies, lock govulncheck and actionlint (#25655) 2023-07-09 11:58:06 +00:00
analyze
assetfs
auth
avatar
base
cache
charset
container
context Update tool dependencies, lock govulncheck and actionlint (#25655) 2023-07-09 11:58:06 +00:00
csv
doctor Less naked returns (#25713) 2023-07-07 05:31:56 +00:00
emoji
eventsource Less naked returns (#25713) 2023-07-07 05:31:56 +00:00
generate
git Update tool dependencies, lock govulncheck and actionlint (#25655) 2023-07-09 11:58:06 +00:00
gitgraph
graceful
hcaptcha
highlight
hostmatcher
html
httpcache Less naked returns (#25713) 2023-07-07 05:31:56 +00:00
httplib Less naked returns (#25713) 2023-07-07 05:31:56 +00:00
indexer Add open/closed field support for issue index (#25708) 2023-07-07 17:10:13 +00:00
issue/template
json
label
lfs
log
markup
mcaptcha
metrics
migration
mirror
nosql Update tool dependencies, lock govulncheck and actionlint (#25655) 2023-07-09 11:58:06 +00:00
notification
options
packages
paginator
pprof
private
process Less naked returns (#25713) 2023-07-07 05:31:56 +00:00
proxy
proxyprotocol
public
queue Update tool dependencies, lock govulncheck and actionlint (#25655) 2023-07-09 11:58:06 +00:00
recaptcha
references
regexplru
repository
secret
session
setting
sitemap
ssh
storage
structs
svg
sync
system
templates
test
testlogger
timeutil
translation
turnstile
typesniffer
updatechecker
upload
uri
user
util Less naked returns (#25713) 2023-07-07 05:31:56 +00:00
validation
web Make route middleware/handler mockable (#25766) 2023-07-09 12:25:53 +00:00
webhook