mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-18 19:37:55 +00:00
fix test
This commit is contained in:
parent
17424891fa
commit
63173a6b31
@ -47,8 +47,9 @@ func TestUploadAttachment(t *testing.T) {
|
||||
|
||||
func TestDeleteAttachments(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
attachment8 := unittest.AssertExistsAndLoadBean(t, &repo_model.Attachment{ID: 8})
|
||||
|
||||
err := DeleteAttachment(db.DefaultContext, &repo_model.Attachment{ID: 8})
|
||||
err := DeleteAttachment(db.DefaultContext, attachment8)
|
||||
assert.NoError(t, err)
|
||||
|
||||
attachment, err := repo_model.GetAttachmentByUUID(db.DefaultContext, "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a18")
|
||||
|
@ -182,7 +182,7 @@ func deleteComment(ctx context.Context, comment *issues_model.Comment, removeAtt
|
||||
}
|
||||
|
||||
func DeleteComment(ctx context.Context, doer *user_model.User, comment *issues_model.Comment) (*issues_model.Comment, error) {
|
||||
deletedReviewComment, cleanup, err := deleteComment(ctx, comment, false)
|
||||
deletedReviewComment, cleanup, err := deleteComment(ctx, comment, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ func deleteIssue(ctx context.Context, issue *issues_model.Issue, deleteAttachmen
|
||||
|
||||
if deleteAttachments {
|
||||
// delete issue attachments
|
||||
_, err := db.GetEngine(ctx).Where("issue_id = ? AND comment_id = 0", issue.ID).NoAutoCondition().Delete(&issues_model.Issue{})
|
||||
_, err := db.GetEngine(ctx).Where("issue_id = ? AND comment_id = 0", issue.ID).NoAutoCondition().Delete(&repo_model.Attachment{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user