mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Refactor names (#31405)
This PR only does "renaming": * `Route` should be `Router` (and chi router is also called "router") * `Params` should be `PathParam` (to distingush it from URL query param, and to match `FormString`) * Use lower case for private functions to avoid exposing or abusing
This commit is contained in:
@@ -81,7 +81,7 @@ func TestWiki(t *testing.T) {
|
||||
unittest.PrepareTestEnv(t)
|
||||
|
||||
ctx, _ := contexttest.MockContext(t, "user2/repo1/wiki")
|
||||
ctx.SetParams("*", "Home")
|
||||
ctx.SetPathParam("*", "Home")
|
||||
contexttest.LoadRepo(t, ctx, 1)
|
||||
Wiki(ctx)
|
||||
assert.EqualValues(t, http.StatusOK, ctx.Resp.Status())
|
||||
@@ -153,7 +153,7 @@ func TestEditWiki(t *testing.T) {
|
||||
unittest.PrepareTestEnv(t)
|
||||
|
||||
ctx, _ := contexttest.MockContext(t, "user2/repo1/wiki/Home?action=_edit")
|
||||
ctx.SetParams("*", "Home")
|
||||
ctx.SetPathParam("*", "Home")
|
||||
contexttest.LoadUser(t, ctx, 2)
|
||||
contexttest.LoadRepo(t, ctx, 1)
|
||||
EditWiki(ctx)
|
||||
@@ -169,7 +169,7 @@ func TestEditWikiPost(t *testing.T) {
|
||||
} {
|
||||
unittest.PrepareTestEnv(t)
|
||||
ctx, _ := contexttest.MockContext(t, "user2/repo1/wiki/Home?action=_new")
|
||||
ctx.SetParams("*", "Home")
|
||||
ctx.SetPathParam("*", "Home")
|
||||
contexttest.LoadUser(t, ctx, 2)
|
||||
contexttest.LoadRepo(t, ctx, 1)
|
||||
web.SetForm(ctx, &forms.NewWikiForm{
|
||||
@@ -211,7 +211,7 @@ func TestWikiRaw(t *testing.T) {
|
||||
unittest.PrepareTestEnv(t)
|
||||
|
||||
ctx, _ := contexttest.MockContext(t, "user2/repo1/wiki/raw/"+url.PathEscape(filepath))
|
||||
ctx.SetParams("*", filepath)
|
||||
ctx.SetPathParam("*", filepath)
|
||||
contexttest.LoadUser(t, ctx, 2)
|
||||
contexttest.LoadRepo(t, ctx, 1)
|
||||
WikiRaw(ctx)
|
||||
@@ -236,7 +236,7 @@ func TestDefaultWikiBranch(t *testing.T) {
|
||||
assert.NoError(t, repo_model.UpdateRepositoryCols(db.DefaultContext, &repo_model.Repository{ID: 1, DefaultWikiBranch: "wrong-branch"}))
|
||||
|
||||
ctx, _ := contexttest.MockContext(t, "user2/repo1/wiki")
|
||||
ctx.SetParams("*", "Home")
|
||||
ctx.SetPathParam("*", "Home")
|
||||
contexttest.LoadRepo(t, ctx, 1)
|
||||
assert.Equal(t, "wrong-branch", ctx.Repo.Repository.DefaultWikiBranch)
|
||||
Wiki(ctx) // after the visiting, the out-of-sync database record will update the branch name to "master"
|
||||
|
Reference in New Issue
Block a user