1
0
Fork 0
forked from forgejo/forgejo

[TESTS] testMiddlewareHook, dependency injection in integration tests

(cherry picked from commit 6623630d10)
(cherry picked from commit d30b9dc5b4)
(cherry picked from commit 8e790a65ba)
This commit is contained in:
Earl Warren 2023-06-05 11:04:47 +02:00
parent ef9494ddef
commit 9d98ba7e5c
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
6 changed files with 28 additions and 19 deletions

View file

@ -14,7 +14,6 @@ import (
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/activitypub"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/routers"
ap "github.com/go-ap/activitypub"
"github.com/stretchr/testify/assert"
@ -22,10 +21,10 @@ import (
func TestActivityPubPerson(t *testing.T) {
setting.Federation.Enabled = true
c = routers.NormalRoutes()
setNormalRoutes()
defer func() {
setting.Federation.Enabled = false
c = routers.NormalRoutes()
setNormalRoutes()
}()
onGiteaRun(t, func(*testing.T, *url.URL) {
@ -60,10 +59,10 @@ func TestActivityPubPerson(t *testing.T) {
func TestActivityPubMissingPerson(t *testing.T) {
setting.Federation.Enabled = true
c = routers.NormalRoutes()
setNormalRoutes()
defer func() {
setting.Federation.Enabled = false
c = routers.NormalRoutes()
setNormalRoutes()
}()
onGiteaRun(t, func(*testing.T, *url.URL) {
@ -75,10 +74,10 @@ func TestActivityPubMissingPerson(t *testing.T) {
func TestActivityPubPersonInbox(t *testing.T) {
setting.Federation.Enabled = true
c = routers.NormalRoutes()
setNormalRoutes()
defer func() {
setting.Federation.Enabled = false
c = routers.NormalRoutes()
setNormalRoutes()
}()
srv := httptest.NewServer(c)