diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-06-18 15:59:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-18 09:59:09 +0200 |
commit | 4e2f1ee58d1aa49f85c3a28a4f96e915f12bdb21 (patch) | |
tree | e2751e1c4673f6a051ef04ca156f428a819fdb66 /routers/web/repo/wiki_test.go | |
parent | fc2115b494e9ba7e4cf7a1440404dce53738b514 (diff) | |
download | gitea-4e2f1ee58d1aa49f85c3a28a4f96e915f12bdb21.tar.gz gitea-4e2f1ee58d1aa49f85c3a28a4f96e915f12bdb21.zip |
Refactor web package and context package (#25298)
1. The "web" package shouldn't depends on "modules/context" package,
instead, let each "web context" register themselves to the "web"
package.
2. The old Init/Free doesn't make sense, so simplify it
* The ctx in "Init(ctx)" is never used, and shouldn't be used that way
* The "Free" is never called and shouldn't be called because the SSPI
instance is shared
---------
Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'routers/web/repo/wiki_test.go')
-rw-r--r-- | routers/web/repo/wiki_test.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/routers/web/repo/wiki_test.go b/routers/web/repo/wiki_test.go index e51820a520..d85879d1e5 100644 --- a/routers/web/repo/wiki_test.go +++ b/routers/web/repo/wiki_test.go @@ -78,7 +78,7 @@ func assertPagesMetas(t *testing.T, expectedNames []string, metas interface{}) { func TestWiki(t *testing.T) { unittest.PrepareTestEnv(t) - ctx := test.MockContext(t, "user2/repo1/wiki/?action=_pages") + ctx, _ := test.MockContext(t, "user2/repo1/wiki/?action=_pages") ctx.SetParams("*", "Home") test.LoadRepo(t, ctx, 1) Wiki(ctx) @@ -90,7 +90,7 @@ func TestWiki(t *testing.T) { func TestWikiPages(t *testing.T) { unittest.PrepareTestEnv(t) - ctx := test.MockContext(t, "user2/repo1/wiki/?action=_pages") + ctx, _ := test.MockContext(t, "user2/repo1/wiki/?action=_pages") test.LoadRepo(t, ctx, 1) WikiPages(ctx) assert.EqualValues(t, http.StatusOK, ctx.Resp.Status()) @@ -100,7 +100,7 @@ func TestWikiPages(t *testing.T) { func TestNewWiki(t *testing.T) { unittest.PrepareTestEnv(t) - ctx := test.MockContext(t, "user2/repo1/wiki/?action=_new") + ctx, _ := test.MockContext(t, "user2/repo1/wiki/?action=_new") test.LoadUser(t, ctx, 2) test.LoadRepo(t, ctx, 1) NewWiki(ctx) @@ -115,7 +115,7 @@ func TestNewWikiPost(t *testing.T) { } { unittest.PrepareTestEnv(t) - ctx := test.MockContext(t, "user2/repo1/wiki/?action=_new") + ctx, _ := test.MockContext(t, "user2/repo1/wiki/?action=_new") test.LoadUser(t, ctx, 2) test.LoadRepo(t, ctx, 1) web.SetForm(ctx, &forms.NewWikiForm{ @@ -133,7 +133,7 @@ func TestNewWikiPost(t *testing.T) { func TestNewWikiPost_ReservedName(t *testing.T) { unittest.PrepareTestEnv(t) - ctx := test.MockContext(t, "user2/repo1/wiki/?action=_new") + ctx, _ := test.MockContext(t, "user2/repo1/wiki/?action=_new") test.LoadUser(t, ctx, 2) test.LoadRepo(t, ctx, 1) web.SetForm(ctx, &forms.NewWikiForm{ @@ -150,7 +150,7 @@ func TestNewWikiPost_ReservedName(t *testing.T) { func TestEditWiki(t *testing.T) { unittest.PrepareTestEnv(t) - ctx := test.MockContext(t, "user2/repo1/wiki/Home?action=_edit") + ctx, _ := test.MockContext(t, "user2/repo1/wiki/Home?action=_edit") ctx.SetParams("*", "Home") test.LoadUser(t, ctx, 2) test.LoadRepo(t, ctx, 1) @@ -166,7 +166,7 @@ func TestEditWikiPost(t *testing.T) { "New/<page>", } { unittest.PrepareTestEnv(t) - ctx := test.MockContext(t, "user2/repo1/wiki/Home?action=_new") + ctx, _ := test.MockContext(t, "user2/repo1/wiki/Home?action=_new") ctx.SetParams("*", "Home") test.LoadUser(t, ctx, 2) test.LoadRepo(t, ctx, 1) @@ -188,7 +188,7 @@ func TestEditWikiPost(t *testing.T) { func TestDeleteWikiPagePost(t *testing.T) { unittest.PrepareTestEnv(t) - ctx := test.MockContext(t, "user2/repo1/wiki/Home?action=_delete") + ctx, _ := test.MockContext(t, "user2/repo1/wiki/Home?action=_delete") test.LoadUser(t, ctx, 2) test.LoadRepo(t, ctx, 1) DeleteWikiPagePost(ctx) @@ -207,7 +207,7 @@ func TestWikiRaw(t *testing.T) { } { unittest.PrepareTestEnv(t) - ctx := test.MockContext(t, "user2/repo1/wiki/raw/"+url.PathEscape(filepath)) + ctx, _ := test.MockContext(t, "user2/repo1/wiki/raw/"+url.PathEscape(filepath)) ctx.SetParams("*", filepath) test.LoadUser(t, ctx, 2) test.LoadRepo(t, ctx, 1) |