aboutsummaryrefslogtreecommitdiffstats
path: root/models/action_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 /models/action_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 'models/action_test.go')
-rw-r--r--models/action_test.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/models/action_test.go b/models/action_test.go
index 85b8290cb2..87bbcf3fb7 100644
--- a/models/action_test.go
+++ b/models/action_test.go
@@ -8,7 +8,6 @@ import (
"path"
"testing"
- "code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/unittest"
"code.gitea.io/gitea/modules/setting"
@@ -17,16 +16,16 @@ import (
func TestAction_GetRepoPath(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
- repo := db.AssertExistsAndLoadBean(t, &Repository{}).(*Repository)
- owner := db.AssertExistsAndLoadBean(t, &User{ID: repo.OwnerID}).(*User)
+ repo := unittest.AssertExistsAndLoadBean(t, &Repository{}).(*Repository)
+ owner := unittest.AssertExistsAndLoadBean(t, &User{ID: repo.OwnerID}).(*User)
action := &Action{RepoID: repo.ID}
assert.Equal(t, path.Join(owner.Name, repo.Name), action.GetRepoPath())
}
func TestAction_GetRepoLink(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
- repo := db.AssertExistsAndLoadBean(t, &Repository{}).(*Repository)
- owner := db.AssertExistsAndLoadBean(t, &User{ID: repo.OwnerID}).(*User)
+ repo := unittest.AssertExistsAndLoadBean(t, &Repository{}).(*Repository)
+ owner := unittest.AssertExistsAndLoadBean(t, &User{ID: repo.OwnerID}).(*User)
action := &Action{RepoID: repo.ID}
setting.AppSubURL = "/suburl"
expected := path.Join(setting.AppSubURL, owner.Name, repo.Name)
@@ -36,7 +35,7 @@ func TestAction_GetRepoLink(t *testing.T) {
func TestGetFeeds(t *testing.T) {
// test with an individual user
assert.NoError(t, unittest.PrepareTestDatabase())
- user := db.AssertExistsAndLoadBean(t, &User{ID: 2}).(*User)
+ user := unittest.AssertExistsAndLoadBean(t, &User{ID: 2}).(*User)
actions, err := GetFeeds(GetFeedsOptions{
RequestedUser: user,
@@ -64,8 +63,8 @@ func TestGetFeeds(t *testing.T) {
func TestGetFeeds2(t *testing.T) {
// test with an organization user
assert.NoError(t, unittest.PrepareTestDatabase())
- org := db.AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
- user := db.AssertExistsAndLoadBean(t, &User{ID: 2}).(*User)
+ org := unittest.AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
+ user := unittest.AssertExistsAndLoadBean(t, &User{ID: 2}).(*User)
actions, err := GetFeeds(GetFeedsOptions{
RequestedUser: org,