|
|
|
@ -173,17 +173,25 @@ func TestViewReleaseListNoLogin(t *testing.T) {
|
|
|
|
|
}, commitsToMain)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestViewSingleReleaseNoLogin(t *testing.T) {
|
|
|
|
|
func TestViewSingleRelease(t *testing.T) {
|
|
|
|
|
defer tests.PrepareTestEnv(t)()
|
|
|
|
|
|
|
|
|
|
req := NewRequest(t, "GET", "/user2/repo-release/releases/tag/v1.0")
|
|
|
|
|
resp := MakeRequest(t, req, http.StatusOK)
|
|
|
|
|
|
|
|
|
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
|
|
|
|
// check the "number of commits to main since this release"
|
|
|
|
|
releaseList := htmlDoc.doc.Find("#release-list .ahead > a")
|
|
|
|
|
assert.EqualValues(t, 1, releaseList.Length())
|
|
|
|
|
assert.EqualValues(t, "3 commits", releaseList.First().Text())
|
|
|
|
|
t.Run("NoLogin", func(t *testing.T) {
|
|
|
|
|
req := NewRequest(t, "GET", "/user2/repo-release/releases/tag/v1.0")
|
|
|
|
|
resp := MakeRequest(t, req, http.StatusOK)
|
|
|
|
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
|
|
|
|
// check the "number of commits to main since this release"
|
|
|
|
|
releaseList := htmlDoc.doc.Find("#release-list .ahead > a")
|
|
|
|
|
assert.EqualValues(t, 1, releaseList.Length())
|
|
|
|
|
assert.EqualValues(t, "3 commits", releaseList.First().Text())
|
|
|
|
|
})
|
|
|
|
|
t.Run("Login", func(t *testing.T) {
|
|
|
|
|
session := loginUser(t, "user1")
|
|
|
|
|
req := NewRequest(t, "GET", "/user2/repo1/releases/tag/delete-tag") // "delete-tag" is the only one with is_tag=true (although strange name)
|
|
|
|
|
resp := session.MakeRequest(t, req, http.StatusOK)
|
|
|
|
|
// the New Release button should contain the tag name
|
|
|
|
|
assert.Contains(t, resp.Body.String(), `<a class="ui small primary button" href="/user2/repo1/releases/new?tag=delete-tag">`)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestViewReleaseListLogin(t *testing.T) {
|
|
|
|
|