File tree 1 file changed +21
-0
lines changed 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1
1
package models
2
2
3
3
import (
4
+ "path"
4
5
"strings"
5
6
"testing"
6
7
8
+ "code.gitea.io/gitea/modules/setting"
9
+
7
10
"github.com/stretchr/testify/assert"
8
11
)
9
12
13
+ func TestAction_GetRepoPath (t * testing.T ) {
14
+ assert .NoError (t , PrepareTestDatabase ())
15
+ repo := AssertExistsAndLoadBean (t , & Repository {}).(* Repository )
16
+ owner := AssertExistsAndLoadBean (t , & User {ID : repo .OwnerID }).(* User )
17
+ action := & Action {RepoID : repo .ID }
18
+ assert .Equal (t , path .Join (owner .Name , repo .Name ), action .GetRepoPath ())
19
+ }
20
+
21
+ func TestAction_GetRepoLink (t * testing.T ) {
22
+ assert .NoError (t , PrepareTestDatabase ())
23
+ repo := AssertExistsAndLoadBean (t , & Repository {}).(* Repository )
24
+ owner := AssertExistsAndLoadBean (t , & User {ID : repo .OwnerID }).(* User )
25
+ action := & Action {RepoID : repo .ID }
26
+ setting .AppSubURL = "/suburl/"
27
+ expected := path .Join (setting .AppSubURL , owner .Name , repo .Name )
28
+ assert .Equal (t , expected , action .GetRepoLink ())
29
+ }
30
+
10
31
func TestNewRepoAction (t * testing.T ) {
11
32
assert .NoError (t , PrepareTestDatabase ())
12
33
You can’t perform that action at this time.
0 commit comments