diff options
author | Daniel Baumann <daniel@debian.org> | 2024-10-18 20:33:49 +0200 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2024-12-12 23:57:56 +0100 |
commit | e68b9d00a6e05b3a941f63ffb696f91e554ac5ec (patch) | |
tree | 97775d6c13b0f416af55314eb6a89ef792474615 /tests/integration/issue_subscribe_test.go | |
parent | Initial commit. (diff) | |
download | forgejo-e68b9d00a6e05b3a941f63ffb696f91e554ac5ec.tar.xz forgejo-e68b9d00a6e05b3a941f63ffb696f91e554ac5ec.zip |
Adding upstream version 9.0.3.
Signed-off-by: Daniel Baumann <daniel@debian.org>
Diffstat (limited to '')
-rw-r--r-- | tests/integration/issue_subscribe_test.go | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/integration/issue_subscribe_test.go b/tests/integration/issue_subscribe_test.go new file mode 100644 index 0000000..32001cd --- /dev/null +++ b/tests/integration/issue_subscribe_test.go @@ -0,0 +1,44 @@ +// Copyright 2024 The Forgejo Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package integration + +import ( + "net/http" + "net/url" + "path" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestIssueSubscribe(t *testing.T) { + onGiteaRun(t, func(t *testing.T, giteaURL *url.URL) { + session := emptyTestSession(t) + testIssueSubscribe(t, *session, true) + }) +} + +func testIssueSubscribe(t *testing.T, session TestSession, unavailable bool) { + t.Helper() + + testIssue := "/user2/repo1/issues/1" + testPull := "/user2/repo1/pulls/2" + selector := ".issue-content-right .watching form" + + resp := session.MakeRequest(t, NewRequest(t, "GET", path.Join(testIssue)), http.StatusOK) + area := NewHTMLParser(t, resp.Body).Find(selector) + tooltip, exists := area.Attr("data-tooltip-content") + assert.EqualValues(t, unavailable, exists) + if unavailable { + assert.EqualValues(t, "Sign in to subscribe to this issue.", tooltip) + } + + resp = session.MakeRequest(t, NewRequest(t, "GET", path.Join(testPull)), http.StatusOK) + area = NewHTMLParser(t, resp.Body).Find(selector) + tooltip, exists = area.Attr("data-tooltip-content") + assert.EqualValues(t, unavailable, exists) + if unavailable { + assert.EqualValues(t, "Sign in to subscribe to this pull request.", tooltip) + } +} |