@@ -7,13 +7,10 @@ import (
7
7
"testing"
8
8
9
9
repo_model "code.gitea.io/gitea/models/repo"
10
- unit_model "code.gitea.io/gitea/models/unit"
11
10
"code.gitea.io/gitea/models/unittest"
12
11
"code.gitea.io/gitea/modules/contexttest"
13
12
"code.gitea.io/gitea/modules/web"
14
13
"code.gitea.io/gitea/services/forms"
15
-
16
- "github.com/stretchr/testify/assert"
17
14
)
18
15
19
16
func TestNewReleasePost (t * testing.T ) {
@@ -65,54 +62,3 @@ func TestNewReleasePost(t *testing.T) {
65
62
ctx .Repo .GitRepo .Close ()
66
63
}
67
64
}
68
-
69
- func TestNewReleasesList (t * testing.T ) {
70
- unittest .PrepareTestEnv (t )
71
- ctx , _ := contexttest .MockContext (t , "user2/repo-release/releases" )
72
- contexttest .LoadUser (t , ctx , 2 )
73
- contexttest .LoadRepo (t , ctx , 57 )
74
- contexttest .LoadGitRepo (t , ctx )
75
- t .Cleanup (func () { ctx .Repo .GitRepo .Close () })
76
-
77
- var err error
78
- ctx .Data ["NumReleases" ], err = repo_model .GetReleaseCountByRepoID (ctx , ctx .Repo .Repository .ID , repo_model.FindReleasesOptions {
79
- IncludeDrafts : ctx .Repo .CanWrite (unit_model .TypeReleases ),
80
- })
81
- assert .NoError (t , err )
82
-
83
- Releases (ctx )
84
- releases := ctx .Data ["Releases" ].([]* repo_model.Release )
85
- type computedFields struct {
86
- NumCommitsBehind int64
87
- TargetBehind string
88
- }
89
- expectedComputation := map [string ]computedFields {
90
- "v1.0" : {
91
- NumCommitsBehind : 3 ,
92
- TargetBehind : "main" ,
93
- },
94
- "v1.1" : {
95
- NumCommitsBehind : 1 ,
96
- TargetBehind : "main" ,
97
- },
98
- "v2.0" : {
99
- NumCommitsBehind : 0 ,
100
- TargetBehind : "main" ,
101
- },
102
- "non-existing-target-branch" : {
103
- NumCommitsBehind : 1 ,
104
- TargetBehind : "main" ,
105
- },
106
- "empty-target-branch" : {
107
- NumCommitsBehind : 1 ,
108
- TargetBehind : "main" ,
109
- },
110
- }
111
- for _ , r := range releases {
112
- actual := computedFields {
113
- NumCommitsBehind : r .NumCommitsBehind ,
114
- TargetBehind : r .TargetBehind ,
115
- }
116
- assert .Equal (t , expectedComputation [r .TagName ], actual , "wrong computed fields for %s: %#v" , r .TagName , r )
117
- }
118
- }
0 commit comments