summaryrefslogtreecommitdiffstats
path: root/models/repo_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/repo_test.go')
-rw-r--r--models/repo_test.go27
1 files changed, 14 insertions, 13 deletions
diff --git a/models/repo_test.go b/models/repo_test.go
index 425e8c0191..2eb6e817ec 100644
--- a/models/repo_test.go
+++ b/models/repo_test.go
@@ -14,13 +14,14 @@ import (
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/unit"
+ "code.gitea.io/gitea/models/unittest"
"code.gitea.io/gitea/modules/markup"
"github.com/stretchr/testify/assert"
)
func TestMetas(t *testing.T) {
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
repo := &Repository{Name: "testRepo"}
repo.Owner = &User{Name: "testOwner"}
@@ -68,7 +69,7 @@ func TestMetas(t *testing.T) {
}
func TestGetRepositoryCount(t *testing.T) {
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
count, err1 := GetRepositoryCount(&User{ID: int64(10)})
privateCount, err2 := GetPrivateRepositoryCount(&User{ID: int64(10)})
@@ -81,7 +82,7 @@ func TestGetRepositoryCount(t *testing.T) {
}
func TestGetPublicRepositoryCount(t *testing.T) {
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
count, err := GetPublicRepositoryCount(&User{ID: int64(10)})
assert.NoError(t, err)
@@ -89,7 +90,7 @@ func TestGetPublicRepositoryCount(t *testing.T) {
}
func TestGetPrivateRepositoryCount(t *testing.T) {
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
count, err := GetPrivateRepositoryCount(&User{ID: int64(10)})
assert.NoError(t, err)
@@ -97,7 +98,7 @@ func TestGetPrivateRepositoryCount(t *testing.T) {
}
func TestUpdateRepositoryVisibilityChanged(t *testing.T) {
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
// Get sample repo and change visibility
repo, err := GetRepositoryByID(9)
@@ -117,7 +118,7 @@ func TestUpdateRepositoryVisibilityChanged(t *testing.T) {
}
func TestGetUserFork(t *testing.T) {
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
// User13 has repo 11 forked from repo10
repo, err := GetRepositoryByID(10)
@@ -136,7 +137,7 @@ func TestGetUserFork(t *testing.T) {
}
func TestRepoAPIURL(t *testing.T) {
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
repo := db.AssertExistsAndLoadBean(t, &Repository{ID: 10}).(*Repository)
assert.Equal(t, "https://try.gitea.io/api/v1/repos/user12/repo10", repo.APIURL())
@@ -148,7 +149,7 @@ func TestUploadAvatar(t *testing.T) {
var buff bytes.Buffer
png.Encode(&buff, myImage)
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
repo := db.AssertExistsAndLoadBean(t, &Repository{ID: 10}).(*Repository)
err := repo.UploadAvatar(buff.Bytes())
@@ -162,7 +163,7 @@ func TestUploadBigAvatar(t *testing.T) {
var buff bytes.Buffer
png.Encode(&buff, myImage)
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
repo := db.AssertExistsAndLoadBean(t, &Repository{ID: 10}).(*Repository)
err := repo.UploadAvatar(buff.Bytes())
@@ -175,7 +176,7 @@ func TestDeleteAvatar(t *testing.T) {
var buff bytes.Buffer
png.Encode(&buff, myImage)
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
repo := db.AssertExistsAndLoadBean(t, &Repository{ID: 10}).(*Repository)
err := repo.UploadAvatar(buff.Bytes())
@@ -188,13 +189,13 @@ func TestDeleteAvatar(t *testing.T) {
}
func TestDoctorUserStarNum(t *testing.T) {
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
assert.NoError(t, DoctorUserStarNum())
}
func TestRepoGetReviewers(t *testing.T) {
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
// test public repo
repo1 := db.AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository)
@@ -211,7 +212,7 @@ func TestRepoGetReviewers(t *testing.T) {
}
func TestRepoGetReviewerTeams(t *testing.T) {
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
repo2 := db.AssertExistsAndLoadBean(t, &Repository{ID: 2}).(*Repository)
teams, err := repo2.GetReviewerTeams()