diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-07-09 14:25:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-09 14:25:53 +0200 |
commit | 819aed35bff81574920c2a87eddbebed5ddfda1f (patch) | |
tree | 8a4bb78dc6de7ca05340e972281f5b3fd01a023a /models/fixtures/team_unit.yml | |
parent | Update tool dependencies, lock govulncheck and actionlint (#25655) (diff) | |
download | forgejo-819aed35bff81574920c2a87eddbebed5ddfda1f.tar.xz forgejo-819aed35bff81574920c2a87eddbebed5ddfda1f.zip |
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.
Diffstat (limited to 'models/fixtures/team_unit.yml')
0 files changed, 0 insertions, 0 deletions