mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-09-15 18:56:59 +00:00
[TESTS] testMiddlewareHook, dependency injection in integration tests
(cherry picked from commit6623630d10
) (cherry picked from commit5e30a4f950
)
This commit is contained in:
parent
8bd051e6df
commit
355a117e74
6 changed files with 32 additions and 18 deletions
|
@ -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(context.TODO())
|
||||
setNormalRoutes()
|
||||
defer func() {
|
||||
setting.Federation.Enabled = false
|
||||
c = routers.NormalRoutes(context.TODO())
|
||||
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(context.TODO())
|
||||
setNormalRoutes()
|
||||
defer func() {
|
||||
setting.Federation.Enabled = false
|
||||
c = routers.NormalRoutes(context.TODO())
|
||||
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(context.TODO())
|
||||
setNormalRoutes()
|
||||
defer func() {
|
||||
setting.Federation.Enabled = false
|
||||
c = routers.NormalRoutes(context.TODO())
|
||||
setNormalRoutes()
|
||||
}()
|
||||
|
||||
srv := httptest.NewServer(c)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue