Skip to content

Commit 9bd8cdb

Browse files
committed
add tests for go-gitea#28765
1 parent 34a0684 commit 9bd8cdb

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/integration/api_user_watch_test.go

+16
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,24 @@ func TestAPIWatch(t *testing.T) {
2323

2424
session := loginUser(t, user)
2525
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeReadUser)
26+
tokenWithReadRepoScope := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeReadRepository)
2627
tokenWithRepoScope := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeReadUser)
2728

29+
t.Run("RepoSubscriptionUnauth", func(t *testing.T) {
30+
defer tests.PrintCurrentTest(t)()
31+
32+
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/subscription", repo))
33+
MakeRequest(t, req, http.StatusUnauthorized)
34+
})
35+
36+
t.Run("RepoSubscriptions", func(t *testing.T) {
37+
defer tests.PrintCurrentTest(t)()
38+
39+
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/subscription", repo)).
40+
AddTokenAuth(tokenWithReadRepoScope)
41+
MakeRequest(t, req, http.StatusOK)
42+
})
43+
2844
t.Run("Watch", func(t *testing.T) {
2945
defer tests.PrintCurrentTest(t)()
3046

0 commit comments

Comments
 (0)