mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	Remove incorrect "db.DefaultContext" usages (#35366)
This commit is contained in:
		| @@ -24,7 +24,7 @@ func TestCreateComment(t *testing.T) { | ||||
| 	doer := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}) | ||||
|  | ||||
| 	now := time.Now().Unix() | ||||
| 	comment, err := issues_model.CreateComment(db.DefaultContext, &issues_model.CreateCommentOptions{ | ||||
| 	comment, err := issues_model.CreateComment(t.Context(), &issues_model.CreateCommentOptions{ | ||||
| 		Type:    issues_model.CommentTypeComment, | ||||
| 		Doer:    doer, | ||||
| 		Repo:    repo, | ||||
| @@ -52,9 +52,9 @@ func Test_UpdateCommentAttachment(t *testing.T) { | ||||
| 	attachment := repo_model.Attachment{ | ||||
| 		Name: "test.txt", | ||||
| 	} | ||||
| 	assert.NoError(t, db.Insert(db.DefaultContext, &attachment)) | ||||
| 	assert.NoError(t, db.Insert(t.Context(), &attachment)) | ||||
|  | ||||
| 	err := issues_model.UpdateCommentAttachments(db.DefaultContext, comment, []string{attachment.UUID}) | ||||
| 	err := issues_model.UpdateCommentAttachments(t.Context(), comment, []string{attachment.UUID}) | ||||
| 	assert.NoError(t, err) | ||||
|  | ||||
| 	attachment2 := unittest.AssertExistsAndLoadBean(t, &repo_model.Attachment{ID: attachment.ID}) | ||||
| @@ -68,7 +68,7 @@ func TestFetchCodeComments(t *testing.T) { | ||||
|  | ||||
| 	issue := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 2}) | ||||
| 	user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}) | ||||
| 	res, err := issues_model.FetchCodeComments(db.DefaultContext, issue, user, false) | ||||
| 	res, err := issues_model.FetchCodeComments(t.Context(), issue, user, false) | ||||
| 	assert.NoError(t, err) | ||||
| 	assert.Contains(t, res, "README.md") | ||||
| 	assert.Contains(t, res["README.md"], int64(4)) | ||||
| @@ -76,7 +76,7 @@ func TestFetchCodeComments(t *testing.T) { | ||||
| 	assert.Equal(t, int64(4), res["README.md"][4][0].ID) | ||||
|  | ||||
| 	user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}) | ||||
| 	res, err = issues_model.FetchCodeComments(db.DefaultContext, issue, user2, false) | ||||
| 	res, err = issues_model.FetchCodeComments(t.Context(), issue, user2, false) | ||||
| 	assert.NoError(t, err) | ||||
| 	assert.Len(t, res, 1) | ||||
| } | ||||
| @@ -92,7 +92,7 @@ func TestAsCommentType(t *testing.T) { | ||||
| func TestMigrate_InsertIssueComments(t *testing.T) { | ||||
| 	assert.NoError(t, unittest.PrepareTestDatabase()) | ||||
| 	issue := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 1}) | ||||
| 	_ = issue.LoadRepo(db.DefaultContext) | ||||
| 	_ = issue.LoadRepo(t.Context()) | ||||
| 	owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: issue.Repo.OwnerID}) | ||||
| 	reaction := &issues_model.Reaction{ | ||||
| 		Type:   "heart", | ||||
| @@ -107,7 +107,7 @@ func TestMigrate_InsertIssueComments(t *testing.T) { | ||||
| 		Reactions: []*issues_model.Reaction{reaction}, | ||||
| 	} | ||||
|  | ||||
| 	err := issues_model.InsertIssueComments(db.DefaultContext, []*issues_model.Comment{comment}) | ||||
| 	err := issues_model.InsertIssueComments(t.Context(), []*issues_model.Comment{comment}) | ||||
| 	assert.NoError(t, err) | ||||
|  | ||||
| 	issueModified := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 1}) | ||||
| @@ -120,7 +120,7 @@ func Test_UpdateIssueNumComments(t *testing.T) { | ||||
| 	assert.NoError(t, unittest.PrepareTestDatabase()) | ||||
| 	issue2 := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 2}) | ||||
|  | ||||
| 	assert.NoError(t, issues_model.UpdateIssueNumComments(db.DefaultContext, issue2.ID)) | ||||
| 	assert.NoError(t, issues_model.UpdateIssueNumComments(t.Context(), issue2.ID)) | ||||
| 	issue2 = unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 2}) | ||||
| 	assert.Equal(t, 1, issue2.NumComments) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user