summaryrefslogtreecommitdiffstats
path: root/modules/convert
diff options
context:
space:
mode:
Diffstat (limited to 'modules/convert')
-rw-r--r--modules/convert/git_commit_test.go5
-rw-r--r--modules/convert/issue_test.go7
-rw-r--r--modules/convert/main_test.go4
-rw-r--r--modules/convert/pull_test.go9
-rw-r--r--modules/convert/user_test.go9
5 files changed, 19 insertions, 15 deletions
diff --git a/modules/convert/git_commit_test.go b/modules/convert/git_commit_test.go
index aa35571706..298a006cb1 100644
--- a/modules/convert/git_commit_test.go
+++ b/modules/convert/git_commit_test.go
@@ -9,6 +9,7 @@ import (
"time"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/git"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"
@@ -17,8 +18,8 @@ import (
)
func TestToCommitMeta(t *testing.T) {
- assert.NoError(t, models.PrepareTestDatabase())
- headRepo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
+ assert.NoError(t, db.PrepareTestDatabase())
+ headRepo := db.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
sha1, _ := git.NewIDFromString("0000000000000000000000000000000000000000")
signature := &git.Signature{Name: "Test Signature", Email: "test@email.com", When: time.Unix(0, 0)}
tag := &git.Tag{
diff --git a/modules/convert/issue_test.go b/modules/convert/issue_test.go
index f3c5b50c8c..7c6b05e816 100644
--- a/modules/convert/issue_test.go
+++ b/modules/convert/issue_test.go
@@ -10,6 +10,7 @@ import (
"time"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/timeutil"
@@ -18,9 +19,9 @@ import (
)
func TestLabel_ToLabel(t *testing.T) {
- assert.NoError(t, models.PrepareTestDatabase())
- label := models.AssertExistsAndLoadBean(t, &models.Label{ID: 1}).(*models.Label)
- repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: label.RepoID}).(*models.Repository)
+ assert.NoError(t, db.PrepareTestDatabase())
+ label := db.AssertExistsAndLoadBean(t, &models.Label{ID: 1}).(*models.Label)
+ repo := db.AssertExistsAndLoadBean(t, &models.Repository{ID: label.RepoID}).(*models.Repository)
assert.Equal(t, &api.Label{
ID: label.ID,
Name: label.Name,
diff --git a/modules/convert/main_test.go b/modules/convert/main_test.go
index 8720ff0427..acb9802f97 100644
--- a/modules/convert/main_test.go
+++ b/modules/convert/main_test.go
@@ -8,9 +8,9 @@ import (
"path/filepath"
"testing"
- "code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/models/db"
)
func TestMain(m *testing.M) {
- models.MainTest(m, filepath.Join("..", ".."))
+ db.MainTest(m, filepath.Join("..", ".."))
}
diff --git a/modules/convert/pull_test.go b/modules/convert/pull_test.go
index adf42d8ca4..655fc76329 100644
--- a/modules/convert/pull_test.go
+++ b/modules/convert/pull_test.go
@@ -8,6 +8,7 @@ import (
"testing"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/structs"
"github.com/stretchr/testify/assert"
@@ -15,9 +16,9 @@ import (
func TestPullRequest_APIFormat(t *testing.T) {
//with HeadRepo
- assert.NoError(t, models.PrepareTestDatabase())
- headRepo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
- pr := models.AssertExistsAndLoadBean(t, &models.PullRequest{ID: 1}).(*models.PullRequest)
+ assert.NoError(t, db.PrepareTestDatabase())
+ headRepo := db.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
+ pr := db.AssertExistsAndLoadBean(t, &models.PullRequest{ID: 1}).(*models.PullRequest)
assert.NoError(t, pr.LoadAttributes())
assert.NoError(t, pr.LoadIssue())
apiPullRequest := ToAPIPullRequest(pr)
@@ -31,7 +32,7 @@ func TestPullRequest_APIFormat(t *testing.T) {
}, apiPullRequest.Head)
//withOut HeadRepo
- pr = models.AssertExistsAndLoadBean(t, &models.PullRequest{ID: 1}).(*models.PullRequest)
+ pr = db.AssertExistsAndLoadBean(t, &models.PullRequest{ID: 1}).(*models.PullRequest)
assert.NoError(t, pr.LoadIssue())
assert.NoError(t, pr.LoadAttributes())
// simulate fork deletion
diff --git a/modules/convert/user_test.go b/modules/convert/user_test.go
index 679c4f9894..404adc2029 100644
--- a/modules/convert/user_test.go
+++ b/modules/convert/user_test.go
@@ -8,20 +8,21 @@ import (
"testing"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/models/db"
api "code.gitea.io/gitea/modules/structs"
"github.com/stretchr/testify/assert"
)
func TestUser_ToUser(t *testing.T) {
- assert.NoError(t, models.PrepareTestDatabase())
+ assert.NoError(t, db.PrepareTestDatabase())
- user1 := models.AssertExistsAndLoadBean(t, &models.User{ID: 1, IsAdmin: true}).(*models.User)
+ user1 := db.AssertExistsAndLoadBean(t, &models.User{ID: 1, IsAdmin: true}).(*models.User)
apiUser := toUser(user1, true, true)
assert.True(t, apiUser.IsAdmin)
- user2 := models.AssertExistsAndLoadBean(t, &models.User{ID: 2, IsAdmin: false}).(*models.User)
+ user2 := db.AssertExistsAndLoadBean(t, &models.User{ID: 2, IsAdmin: false}).(*models.User)
apiUser = toUser(user2, true, true)
assert.False(t, apiUser.IsAdmin)
@@ -30,7 +31,7 @@ func TestUser_ToUser(t *testing.T) {
assert.False(t, apiUser.IsAdmin)
assert.EqualValues(t, api.VisibleTypePublic.String(), apiUser.Visibility)
- user31 := models.AssertExistsAndLoadBean(t, &models.User{ID: 31, IsAdmin: false, Visibility: api.VisibleTypePrivate}).(*models.User)
+ user31 := db.AssertExistsAndLoadBean(t, &models.User{ID: 31, IsAdmin: false, Visibility: api.VisibleTypePrivate}).(*models.User)
apiUser = toUser(user31, true, true)
assert.False(t, apiUser.IsAdmin)