mirror of
https://github.com/go-gitea/gitea
synced 2025-08-29 12:58:29 +00:00
Remove wrong "git.DefaultContext" (#35364)
This commit is contained in:
@@ -144,11 +144,11 @@ func TestRepository_InitWiki(t *testing.T) {
|
||||
unittest.PrepareTestEnv(t)
|
||||
// repo1 already has a wiki
|
||||
repo1 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
|
||||
assert.NoError(t, InitWiki(git.DefaultContext, repo1))
|
||||
assert.NoError(t, InitWiki(t.Context(), repo1))
|
||||
|
||||
// repo2 does not already have a wiki
|
||||
repo2 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 2})
|
||||
assert.NoError(t, InitWiki(git.DefaultContext, repo2))
|
||||
assert.NoError(t, InitWiki(t.Context(), repo2))
|
||||
assert.True(t, repo2.HasWiki())
|
||||
}
|
||||
|
||||
@@ -164,9 +164,9 @@ func TestRepository_AddWikiPage(t *testing.T) {
|
||||
} {
|
||||
t.Run("test wiki exist: "+userTitle, func(t *testing.T) {
|
||||
webPath := UserTitleToWebPath("", userTitle)
|
||||
assert.NoError(t, AddWikiPage(git.DefaultContext, doer, repo, webPath, wikiContent, commitMsg))
|
||||
assert.NoError(t, AddWikiPage(t.Context(), doer, repo, webPath, wikiContent, commitMsg))
|
||||
// Now need to show that the page has been added:
|
||||
gitRepo, err := gitrepo.OpenRepository(git.DefaultContext, repo.WikiStorageRepo())
|
||||
gitRepo, err := gitrepo.OpenRepository(t.Context(), repo.WikiStorageRepo())
|
||||
require.NoError(t, err)
|
||||
|
||||
defer gitRepo.Close()
|
||||
@@ -182,7 +182,7 @@ func TestRepository_AddWikiPage(t *testing.T) {
|
||||
t.Run("check wiki already exist", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
// test for already-existing wiki name
|
||||
err := AddWikiPage(git.DefaultContext, doer, repo, "Home", wikiContent, commitMsg)
|
||||
err := AddWikiPage(t.Context(), doer, repo, "Home", wikiContent, commitMsg)
|
||||
assert.Error(t, err)
|
||||
assert.True(t, repo_model.IsErrWikiAlreadyExist(err))
|
||||
})
|
||||
@@ -190,7 +190,7 @@ func TestRepository_AddWikiPage(t *testing.T) {
|
||||
t.Run("check wiki reserved name", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
// test for reserved wiki name
|
||||
err := AddWikiPage(git.DefaultContext, doer, repo, "_edit", wikiContent, commitMsg)
|
||||
err := AddWikiPage(t.Context(), doer, repo, "_edit", wikiContent, commitMsg)
|
||||
assert.Error(t, err)
|
||||
assert.True(t, repo_model.IsErrWikiReservedName(err))
|
||||
})
|
||||
@@ -210,10 +210,10 @@ func TestRepository_EditWikiPage(t *testing.T) {
|
||||
} {
|
||||
webPath := UserTitleToWebPath("", newWikiName)
|
||||
unittest.PrepareTestEnv(t)
|
||||
assert.NoError(t, EditWikiPage(git.DefaultContext, doer, repo, "Home", webPath, newWikiContent, commitMsg))
|
||||
assert.NoError(t, EditWikiPage(t.Context(), doer, repo, "Home", webPath, newWikiContent, commitMsg))
|
||||
|
||||
// Now need to show that the page has been added:
|
||||
gitRepo, err := gitrepo.OpenRepository(git.DefaultContext, repo.WikiStorageRepo())
|
||||
gitRepo, err := gitrepo.OpenRepository(t.Context(), repo.WikiStorageRepo())
|
||||
assert.NoError(t, err)
|
||||
masterTree, err := gitRepo.GetTree(repo.DefaultWikiBranch)
|
||||
assert.NoError(t, err)
|
||||
@@ -234,10 +234,10 @@ func TestRepository_DeleteWikiPage(t *testing.T) {
|
||||
unittest.PrepareTestEnv(t)
|
||||
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
|
||||
doer := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
|
||||
assert.NoError(t, DeleteWikiPage(git.DefaultContext, doer, repo, "Home"))
|
||||
assert.NoError(t, DeleteWikiPage(t.Context(), doer, repo, "Home"))
|
||||
|
||||
// Now need to show that the page has been added:
|
||||
gitRepo, err := gitrepo.OpenRepository(git.DefaultContext, repo.WikiStorageRepo())
|
||||
gitRepo, err := gitrepo.OpenRepository(t.Context(), repo.WikiStorageRepo())
|
||||
require.NoError(t, err)
|
||||
|
||||
defer gitRepo.Close()
|
||||
@@ -251,7 +251,7 @@ func TestRepository_DeleteWikiPage(t *testing.T) {
|
||||
func TestPrepareWikiFileName(t *testing.T) {
|
||||
unittest.PrepareTestEnv(t)
|
||||
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
|
||||
gitRepo, err := gitrepo.OpenRepository(git.DefaultContext, repo.WikiStorageRepo())
|
||||
gitRepo, err := gitrepo.OpenRepository(t.Context(), repo.WikiStorageRepo())
|
||||
require.NoError(t, err)
|
||||
|
||||
defer gitRepo.Close()
|
||||
@@ -301,10 +301,10 @@ func TestPrepareWikiFileName_FirstPage(t *testing.T) {
|
||||
// Now create a temporaryDirectory
|
||||
tmpDir := t.TempDir()
|
||||
|
||||
err := git.InitRepository(git.DefaultContext, tmpDir, true, git.Sha1ObjectFormat.Name())
|
||||
err := git.InitRepository(t.Context(), tmpDir, true, git.Sha1ObjectFormat.Name())
|
||||
assert.NoError(t, err)
|
||||
|
||||
gitRepo, err := git.OpenRepository(git.DefaultContext, tmpDir)
|
||||
gitRepo, err := git.OpenRepository(t.Context(), tmpDir)
|
||||
require.NoError(t, err)
|
||||
|
||||
defer gitRepo.Close()
|
||||
|
Reference in New Issue
Block a user