Decouple unit test, remove intermediate unittestbridge
package (#17662)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
23bd7b1211
commit
81926d61db
151 changed files with 1719 additions and 1781 deletions
|
@ -138,7 +138,7 @@ func TestGetUserFork(t *testing.T) {
|
|||
|
||||
func TestRepoAPIURL(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
repo := db.AssertExistsAndLoadBean(t, &Repository{ID: 10}).(*Repository)
|
||||
repo := unittest.AssertExistsAndLoadBean(t, &Repository{ID: 10}).(*Repository)
|
||||
|
||||
assert.Equal(t, "https://try.gitea.io/api/v1/repos/user12/repo10", repo.APIURL())
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ func TestUploadAvatar(t *testing.T) {
|
|||
png.Encode(&buff, myImage)
|
||||
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
repo := db.AssertExistsAndLoadBean(t, &Repository{ID: 10}).(*Repository)
|
||||
repo := unittest.AssertExistsAndLoadBean(t, &Repository{ID: 10}).(*Repository)
|
||||
|
||||
err := repo.UploadAvatar(buff.Bytes())
|
||||
assert.NoError(t, err)
|
||||
|
@ -164,7 +164,7 @@ func TestUploadBigAvatar(t *testing.T) {
|
|||
png.Encode(&buff, myImage)
|
||||
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
repo := db.AssertExistsAndLoadBean(t, &Repository{ID: 10}).(*Repository)
|
||||
repo := unittest.AssertExistsAndLoadBean(t, &Repository{ID: 10}).(*Repository)
|
||||
|
||||
err := repo.UploadAvatar(buff.Bytes())
|
||||
assert.Error(t, err)
|
||||
|
@ -177,7 +177,7 @@ func TestDeleteAvatar(t *testing.T) {
|
|||
png.Encode(&buff, myImage)
|
||||
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
repo := db.AssertExistsAndLoadBean(t, &Repository{ID: 10}).(*Repository)
|
||||
repo := unittest.AssertExistsAndLoadBean(t, &Repository{ID: 10}).(*Repository)
|
||||
|
||||
err := repo.UploadAvatar(buff.Bytes())
|
||||
assert.NoError(t, err)
|
||||
|
@ -198,14 +198,14 @@ func TestRepoGetReviewers(t *testing.T) {
|
|||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
// test public repo
|
||||
repo1 := db.AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository)
|
||||
repo1 := unittest.AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository)
|
||||
|
||||
reviewers, err := repo1.GetReviewers(2, 2)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, reviewers, 4)
|
||||
|
||||
// test private repo
|
||||
repo2 := db.AssertExistsAndLoadBean(t, &Repository{ID: 2}).(*Repository)
|
||||
repo2 := unittest.AssertExistsAndLoadBean(t, &Repository{ID: 2}).(*Repository)
|
||||
reviewers, err = repo2.GetReviewers(2, 2)
|
||||
assert.NoError(t, err)
|
||||
assert.Empty(t, reviewers)
|
||||
|
@ -214,12 +214,12 @@ func TestRepoGetReviewers(t *testing.T) {
|
|||
func TestRepoGetReviewerTeams(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
repo2 := db.AssertExistsAndLoadBean(t, &Repository{ID: 2}).(*Repository)
|
||||
repo2 := unittest.AssertExistsAndLoadBean(t, &Repository{ID: 2}).(*Repository)
|
||||
teams, err := repo2.GetReviewerTeams()
|
||||
assert.NoError(t, err)
|
||||
assert.Empty(t, teams)
|
||||
|
||||
repo3 := db.AssertExistsAndLoadBean(t, &Repository{ID: 3}).(*Repository)
|
||||
repo3 := unittest.AssertExistsAndLoadBean(t, &Repository{ID: 3}).(*Repository)
|
||||
teams, err = repo3.GetReviewerTeams()
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, teams, 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue