File tree 2 files changed +11
-5
lines changed
2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 1
1
package models
2
2
3
3
import (
4
- "os"
5
4
"path"
6
5
"strings"
7
6
"testing"
8
7
9
8
"code.gitea.io/git"
10
9
"code.gitea.io/gitea/modules/setting"
11
10
12
- "github.com/Unknwon/com"
13
11
"github.com/stretchr/testify/assert"
14
12
)
15
13
@@ -299,9 +297,7 @@ func TestCommitRepoAction(t *testing.T) {
299
297
}
300
298
301
299
for _ , s := range samples {
302
- assert .NoError (t , PrepareTestDatabase ())
303
- assert .NoError (t , os .RemoveAll (setting .RepoRootPath ))
304
- assert .NoError (t , com .CopyDir ("../integrations/gitea-repositories-meta" , setting .RepoRootPath ))
300
+ prepareTestEnv (t )
305
301
306
302
user := AssertExistsAndLoadBean (t , & User {ID : s .userID }).(* User )
307
303
repo := AssertExistsAndLoadBean (t , & Repository {ID : s .repositoryID , OwnerID : user .ID }).(* Repository )
Original file line number Diff line number Diff line change 5
5
package models
6
6
7
7
import (
8
+ "os"
8
9
"testing"
9
10
11
+ "code.gitea.io/gitea/modules/setting"
12
+
13
+ "github.com/Unknwon/com"
10
14
"github.com/go-xorm/core"
11
15
"github.com/go-xorm/xorm"
12
16
"github.com/stretchr/testify/assert"
@@ -38,6 +42,12 @@ func PrepareTestDatabase() error {
38
42
return LoadFixtures ()
39
43
}
40
44
45
+ func prepareTestEnv (t testing.TB ) {
46
+ assert .NoError (t , PrepareTestDatabase ())
47
+ assert .NoError (t , os .RemoveAll (setting .RepoRootPath ))
48
+ assert .NoError (t , com .CopyDir ("../integrations/gitea-repositories-meta" , setting .RepoRootPath ))
49
+ }
50
+
41
51
type testCond struct {
42
52
query interface {}
43
53
args []interface {}
You can’t perform that action at this time.
0 commit comments