Decouple unit test code from business code (#17623)

This commit is contained in:
wxiaoguang 2021-11-12 22:36:47 +08:00 committed by GitHub
parent 7f802631c5
commit df64fa4865
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
136 changed files with 1058 additions and 830 deletions

View file

@ -9,14 +9,14 @@ import (
"testing"
"time"
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/unittest"
"code.gitea.io/gitea/modules/test"
"github.com/stretchr/testify/assert"
)
func TestMain(m *testing.M) {
db.MainTest(m, filepath.Join("..", ".."))
unittest.MainTest(m, filepath.Join("..", ".."))
}
func waitForCount(t *testing.T, num int) {
@ -24,7 +24,7 @@ func waitForCount(t *testing.T, num int) {
}
func TestArchive_Basic(t *testing.T) {
assert.NoError(t, db.PrepareTestDatabase())
assert.NoError(t, unittest.PrepareTestDatabase())
ctx := test.MockContext(t, "user27/repo49")
firstCommit, secondCommit := "51f84af23134", "aacbdfe9e1c4"