Skip to content

Commit 6ead82c

Browse files
committed
remove TestNewReleasesList
1 parent 99f3ec2 commit 6ead82c

File tree

1 file changed

+0
-54
lines changed

1 file changed

+0
-54
lines changed

routers/web/repo/release_test.go

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@ import (
77
"testing"
88

99
repo_model "code.gitea.io/gitea/models/repo"
10-
unit_model "code.gitea.io/gitea/models/unit"
1110
"code.gitea.io/gitea/models/unittest"
1211
"code.gitea.io/gitea/modules/contexttest"
1312
"code.gitea.io/gitea/modules/web"
1413
"code.gitea.io/gitea/services/forms"
15-
16-
"github.com/stretchr/testify/assert"
1714
)
1815

1916
func TestNewReleasePost(t *testing.T) {
@@ -65,54 +62,3 @@ func TestNewReleasePost(t *testing.T) {
6562
ctx.Repo.GitRepo.Close()
6663
}
6764
}
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

Comments
 (0)