aboutsummaryrefslogtreecommitdiffstats
path: root/models/admin_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/admin_test.go')
-rw-r--r--models/admin_test.go49
1 files changed, 24 insertions, 25 deletions
diff --git a/models/admin_test.go b/models/admin_test.go
index ea060f9726..95415731b2 100644
--- a/models/admin_test.go
+++ b/models/admin_test.go
@@ -7,7 +7,6 @@ package models
import (
"testing"
- "code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/unittest"
"github.com/stretchr/testify/assert"
)
@@ -27,9 +26,9 @@ func TestCreateNotice(t *testing.T) {
Type: NoticeRepository,
Description: "test description",
}
- db.AssertNotExistsBean(t, noticeBean)
+ unittest.AssertNotExistsBean(t, noticeBean)
assert.NoError(t, CreateNotice(noticeBean.Type, noticeBean.Description))
- db.AssertExistsAndLoadBean(t, noticeBean)
+ unittest.AssertExistsAndLoadBean(t, noticeBean)
}
func TestCreateRepositoryNotice(t *testing.T) {
@@ -39,9 +38,9 @@ func TestCreateRepositoryNotice(t *testing.T) {
Type: NoticeRepository,
Description: "test description",
}
- db.AssertNotExistsBean(t, noticeBean)
+ unittest.AssertNotExistsBean(t, noticeBean)
assert.NoError(t, CreateRepositoryNotice(noticeBean.Description))
- db.AssertExistsAndLoadBean(t, noticeBean)
+ unittest.AssertExistsAndLoadBean(t, noticeBean)
}
// TODO TestRemoveAllWithNotice
@@ -71,45 +70,45 @@ func TestNotices(t *testing.T) {
func TestDeleteNotice(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
- db.AssertExistsAndLoadBean(t, &Notice{ID: 3})
+ unittest.AssertExistsAndLoadBean(t, &Notice{ID: 3})
assert.NoError(t, DeleteNotice(3))
- db.AssertNotExistsBean(t, &Notice{ID: 3})
+ unittest.AssertNotExistsBean(t, &Notice{ID: 3})
}
func TestDeleteNotices(t *testing.T) {
// delete a non-empty range
assert.NoError(t, unittest.PrepareTestDatabase())
- db.AssertExistsAndLoadBean(t, &Notice{ID: 1})
- db.AssertExistsAndLoadBean(t, &Notice{ID: 2})
- db.AssertExistsAndLoadBean(t, &Notice{ID: 3})
+ unittest.AssertExistsAndLoadBean(t, &Notice{ID: 1})
+ unittest.AssertExistsAndLoadBean(t, &Notice{ID: 2})
+ unittest.AssertExistsAndLoadBean(t, &Notice{ID: 3})
assert.NoError(t, DeleteNotices(1, 2))
- db.AssertNotExistsBean(t, &Notice{ID: 1})
- db.AssertNotExistsBean(t, &Notice{ID: 2})
- db.AssertExistsAndLoadBean(t, &Notice{ID: 3})
+ unittest.AssertNotExistsBean(t, &Notice{ID: 1})
+ unittest.AssertNotExistsBean(t, &Notice{ID: 2})
+ unittest.AssertExistsAndLoadBean(t, &Notice{ID: 3})
}
func TestDeleteNotices2(t *testing.T) {
// delete an empty range
assert.NoError(t, unittest.PrepareTestDatabase())
- db.AssertExistsAndLoadBean(t, &Notice{ID: 1})
- db.AssertExistsAndLoadBean(t, &Notice{ID: 2})
- db.AssertExistsAndLoadBean(t, &Notice{ID: 3})
+ unittest.AssertExistsAndLoadBean(t, &Notice{ID: 1})
+ unittest.AssertExistsAndLoadBean(t, &Notice{ID: 2})
+ unittest.AssertExistsAndLoadBean(t, &Notice{ID: 3})
assert.NoError(t, DeleteNotices(3, 2))
- db.AssertExistsAndLoadBean(t, &Notice{ID: 1})
- db.AssertExistsAndLoadBean(t, &Notice{ID: 2})
- db.AssertExistsAndLoadBean(t, &Notice{ID: 3})
+ unittest.AssertExistsAndLoadBean(t, &Notice{ID: 1})
+ unittest.AssertExistsAndLoadBean(t, &Notice{ID: 2})
+ unittest.AssertExistsAndLoadBean(t, &Notice{ID: 3})
}
func TestDeleteNoticesByIDs(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
- db.AssertExistsAndLoadBean(t, &Notice{ID: 1})
- db.AssertExistsAndLoadBean(t, &Notice{ID: 2})
- db.AssertExistsAndLoadBean(t, &Notice{ID: 3})
+ unittest.AssertExistsAndLoadBean(t, &Notice{ID: 1})
+ unittest.AssertExistsAndLoadBean(t, &Notice{ID: 2})
+ unittest.AssertExistsAndLoadBean(t, &Notice{ID: 3})
assert.NoError(t, DeleteNoticesByIDs([]int64{1, 3}))
- db.AssertNotExistsBean(t, &Notice{ID: 1})
- db.AssertExistsAndLoadBean(t, &Notice{ID: 2})
- db.AssertNotExistsBean(t, &Notice{ID: 3})
+ unittest.AssertNotExistsBean(t, &Notice{ID: 1})
+ unittest.AssertExistsAndLoadBean(t, &Notice{ID: 2})
+ unittest.AssertNotExistsBean(t, &Notice{ID: 3})
}