summaryrefslogtreecommitdiffstats
path: root/models/branches_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/branches_test.go')
-rw-r--r--models/branches_test.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/models/branches_test.go b/models/branches_test.go
index e9a32666f9..d7233fba65 100644
--- a/models/branches_test.go
+++ b/models/branches_test.go
@@ -8,11 +8,12 @@ import (
"testing"
"code.gitea.io/gitea/models/db"
+ "code.gitea.io/gitea/models/unittest"
"github.com/stretchr/testify/assert"
)
func TestAddDeletedBranch(t *testing.T) {
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
repo := db.AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository)
firstBranch := db.AssertExistsAndLoadBean(t, &DeletedBranch{ID: 1}).(*DeletedBranch)
@@ -21,7 +22,7 @@ func TestAddDeletedBranch(t *testing.T) {
}
func TestGetDeletedBranches(t *testing.T) {
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
repo := db.AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository)
branches, err := repo.GetDeletedBranches()
@@ -30,14 +31,14 @@ func TestGetDeletedBranches(t *testing.T) {
}
func TestGetDeletedBranch(t *testing.T) {
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
firstBranch := db.AssertExistsAndLoadBean(t, &DeletedBranch{ID: 1}).(*DeletedBranch)
assert.NotNil(t, getDeletedBranch(t, firstBranch))
}
func TestDeletedBranchLoadUser(t *testing.T) {
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
firstBranch := db.AssertExistsAndLoadBean(t, &DeletedBranch{ID: 1}).(*DeletedBranch)
secondBranch := db.AssertExistsAndLoadBean(t, &DeletedBranch{ID: 2}).(*DeletedBranch)
@@ -56,7 +57,7 @@ func TestDeletedBranchLoadUser(t *testing.T) {
}
func TestRemoveDeletedBranch(t *testing.T) {
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
repo := db.AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository)
firstBranch := db.AssertExistsAndLoadBean(t, &DeletedBranch{ID: 1}).(*DeletedBranch)
@@ -81,7 +82,7 @@ func getDeletedBranch(t *testing.T, branch *DeletedBranch) *DeletedBranch {
}
func TestFindRenamedBranch(t *testing.T) {
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
branch, exist, err := FindRenamedBranch(1, "dev")
assert.NoError(t, err)
assert.Equal(t, true, exist)
@@ -93,7 +94,7 @@ func TestFindRenamedBranch(t *testing.T) {
}
func TestRenameBranch(t *testing.T) {
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
repo1 := db.AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository)
_isDefault := false
@@ -130,7 +131,7 @@ func TestRenameBranch(t *testing.T) {
}
func TestOnlyGetDeletedBranchOnCorrectRepo(t *testing.T) {
- assert.NoError(t, db.PrepareTestDatabase())
+ assert.NoError(t, unittest.PrepareTestDatabase())
// Get deletedBranch with ID of 1 on repo with ID 2.
// This should return a nil branch as this deleted branch