forgejo/tests/integration/issue_subscribe_test.go
Renovate Bot fed2d81c44
Some checks failed
/ release (push) Waiting to run
testing / backend-checks (push) Has been skipped
testing / frontend-checks (push) Has been skipped
testing / test-unit (push) Has been skipped
testing / test-e2e (push) Has been skipped
testing / test-mysql (push) Has been skipped
testing / test-pgsql (push) Has been skipped
testing / test-sqlite (push) Has been skipped
testing / test-remote-cacher (redis) (push) Has been skipped
testing / test-remote-cacher (valkey) (push) Has been skipped
testing / test-remote-cacher (garnet) (push) Has been skipped
testing / test-remote-cacher (redict) (push) Has been skipped
testing / security-check (push) Has been skipped
Integration tests for the release process / release-simulation (push) Has been cancelled
Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367)
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-03-28 22:22:21 +00:00

44 lines
1.2 KiB
Go

// 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.Equal(t, unavailable, exists)
if unavailable {
assert.Equal(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.Equal(t, unavailable, exists)
if unavailable {
assert.Equal(t, "Sign in to subscribe to this pull request.", tooltip)
}
}