Require token for GET subscription endpoint (#28765) (#28778)

Backport #28765 for 1.21

(cherry picked from commit 56e722f825afacfa88a814d16ac200c7bfa06f91)
This commit is contained in:
Jack Hay 2024-01-12 21:01:15 -05:00 committed by Earl Warren
parent 10b555a52b
commit 0841fb63a1
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -63,7 +63,10 @@ func TestAPIWatch(t *testing.T) {
t.Run("IsWatching", func(t *testing.T) {
defer tests.PrintCurrentTest(t)()
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/subscription?token=%s", repo, tokenWithRepoScope))
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/subscription", repo))
MakeRequest(t, req, http.StatusUnauthorized)
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/subscription?token=%s", repo, tokenWithRepoScope))
MakeRequest(t, req, http.StatusOK)
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/subscription?token=%s", repo+"notexisting", tokenWithRepoScope))