Skip to content

Commit 2997ab8

Browse files
committed
Fix test
1 parent 92d0451 commit 2997ab8

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

integrations/delete_user_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
"testing"
1111

1212
"code.gitea.io/gitea/models"
13-
user_model "code.gitea.io/gitea/models/user"
1413
"code.gitea.io/gitea/models/unittest"
14+
user_model "code.gitea.io/gitea/models/user"
1515
)
1616

1717
func assertUserDeleted(t *testing.T, userID int64) {

models/user/follow_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ package user
77
import (
88
"testing"
99

10-
"code.gitea.io/gitea/models/db"
10+
"code.gitea.io/gitea/models/unittest"
11+
1112
"github.com/stretchr/testify/assert"
1213
)
1314

1415
func TestIsFollowing(t *testing.T) {
15-
assert.NoError(t, db.PrepareTestDatabase())
16+
assert.NoError(t, unittest.PrepareTestDatabase())
1617
assert.True(t, IsFollowing(4, 2))
1718
assert.False(t, IsFollowing(2, 4))
18-
assert.False(t, IsFollowing(5, db.NonexistentID))
19-
assert.False(t, IsFollowing(db.NonexistentID, 5))
20-
assert.False(t, IsFollowing(db.NonexistentID, db.NonexistentID))
19+
assert.False(t, IsFollowing(5, unittest.NonexistentID))
20+
assert.False(t, IsFollowing(unittest.NonexistentID, 5))
21+
assert.False(t, IsFollowing(unittest.NonexistentID, unittest.NonexistentID))
2122
}

models/user_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -562,36 +562,36 @@ func TestNewUserRedirect3(t *testing.T) {
562562
}
563563

564564
func TestFollowUser(t *testing.T) {
565-
assert.NoError(t, db.PrepareTestDatabase())
565+
assert.NoError(t, unittest.PrepareTestDatabase())
566566

567567
testSuccess := func(followerID, followedID int64) {
568568
assert.NoError(t, user_model.FollowUser(followerID, followedID))
569-
db.AssertExistsAndLoadBean(t, &user_model.Follow{UserID: followerID, FollowID: followedID})
569+
unittest.AssertExistsAndLoadBean(t, &user_model.Follow{UserID: followerID, FollowID: followedID})
570570
}
571571
testSuccess(4, 2)
572572
testSuccess(5, 2)
573573

574574
assert.NoError(t, user_model.FollowUser(2, 2))
575575

576-
CheckConsistencyFor(t, &User{})
576+
unittest.CheckConsistencyFor(t, &User{})
577577
}
578578

579579
func TestUnfollowUser(t *testing.T) {
580-
assert.NoError(t, db.PrepareTestDatabase())
580+
assert.NoError(t, unittest.PrepareTestDatabase())
581581

582582
testSuccess := func(followerID, followedID int64) {
583583
assert.NoError(t, user_model.UnfollowUser(followerID, followedID))
584-
db.AssertNotExistsBean(t, &user_model.Follow{UserID: followerID, FollowID: followedID})
584+
unittest.AssertNotExistsBean(t, &user_model.Follow{UserID: followerID, FollowID: followedID})
585585
}
586586
testSuccess(4, 2)
587587
testSuccess(5, 2)
588588
testSuccess(2, 2)
589589

590-
CheckConsistencyFor(t, &User{})
590+
unittest.CheckConsistencyFor(t, &User{})
591591
}
592592

593593
func TestGetUserByOpenID(t *testing.T) {
594-
assert.NoError(t, db.PrepareTestDatabase())
594+
assert.NoError(t, unittest.PrepareTestDatabase())
595595

596596
_, err := GetUserByOpenID("https://unknown")
597597
if assert.Error(t, err) {

0 commit comments

Comments
 (0)