summaryrefslogtreecommitdiffstats
path: root/integrations/delete_user_test.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2021-11-16 16:53:21 +0800
committerGitHub <noreply@github.com>2021-11-16 16:53:21 +0800
commit81926d61db3dac223a75ea49eab893b25a089587 (patch)
tree627d2f19a008089f3a688e9a94a2cc8d2017afe2 /integrations/delete_user_test.go
parent23bd7b1211a80aa3b0dcb60ec4a1c0089ff28dd4 (diff)
downloadgitea-81926d61db3dac223a75ea49eab893b25a089587.tar.gz
gitea-81926d61db3dac223a75ea49eab893b25a089587.zip
Decouple unit test, remove intermediate `unittestbridge` package (#17662)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'integrations/delete_user_test.go')
-rw-r--r--integrations/delete_user_test.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/integrations/delete_user_test.go b/integrations/delete_user_test.go
index f529734e19..86896c8ae1 100644
--- a/integrations/delete_user_test.go
+++ b/integrations/delete_user_test.go
@@ -10,19 +10,19 @@ import (
"testing"
"code.gitea.io/gitea/models"
- "code.gitea.io/gitea/models/db"
+ "code.gitea.io/gitea/models/unittest"
)
func assertUserDeleted(t *testing.T, userID int64) {
- db.AssertNotExistsBean(t, &models.User{ID: userID})
- db.AssertNotExistsBean(t, &models.Follow{UserID: userID})
- db.AssertNotExistsBean(t, &models.Follow{FollowID: userID})
- db.AssertNotExistsBean(t, &models.Repository{OwnerID: userID})
- db.AssertNotExistsBean(t, &models.Access{UserID: userID})
- db.AssertNotExistsBean(t, &models.OrgUser{UID: userID})
- db.AssertNotExistsBean(t, &models.IssueUser{UID: userID})
- db.AssertNotExistsBean(t, &models.TeamUser{UID: userID})
- db.AssertNotExistsBean(t, &models.Star{UID: userID})
+ unittest.AssertNotExistsBean(t, &models.User{ID: userID})
+ unittest.AssertNotExistsBean(t, &models.Follow{UserID: userID})
+ unittest.AssertNotExistsBean(t, &models.Follow{FollowID: userID})
+ unittest.AssertNotExistsBean(t, &models.Repository{OwnerID: userID})
+ unittest.AssertNotExistsBean(t, &models.Access{UserID: userID})
+ unittest.AssertNotExistsBean(t, &models.OrgUser{UID: userID})
+ unittest.AssertNotExistsBean(t, &models.IssueUser{UID: userID})
+ unittest.AssertNotExistsBean(t, &models.TeamUser{UID: userID})
+ unittest.AssertNotExistsBean(t, &models.Star{UID: userID})
}
func TestUserDeleteAccount(t *testing.T) {
@@ -37,7 +37,7 @@ func TestUserDeleteAccount(t *testing.T) {
session.MakeRequest(t, req, http.StatusFound)
assertUserDeleted(t, 8)
- models.CheckConsistencyFor(t, &models.User{})
+ unittest.CheckConsistencyFor(t, &models.User{})
}
func TestUserDeleteAccountStillOwnRepos(t *testing.T) {
@@ -52,5 +52,5 @@ func TestUserDeleteAccountStillOwnRepos(t *testing.T) {
session.MakeRequest(t, req, http.StatusFound)
// user should not have been deleted, because the user still owns repos
- db.AssertExistsAndLoadBean(t, &models.User{ID: 2})
+ unittest.AssertExistsAndLoadBean(t, &models.User{ID: 2})
}