Skip to content

Commit

Permalink
add tests for go-gitea#28765
Browse files Browse the repository at this point in the history
  • Loading branch information
jackHay22 committed Jan 12, 2024
1 parent 34a0684 commit 9bd8cdb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/integration/api_user_watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,24 @@ func TestAPIWatch(t *testing.T) {

session := loginUser(t, user)
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeReadUser)
tokenWithReadRepoScope := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeReadRepository)
tokenWithRepoScope := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeReadUser)

t.Run("RepoSubscriptionUnauth", func(t *testing.T) {
defer tests.PrintCurrentTest(t)()

req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/subscription", repo))
MakeRequest(t, req, http.StatusUnauthorized)
})

t.Run("RepoSubscriptions", func(t *testing.T) {
defer tests.PrintCurrentTest(t)()

req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/subscription", repo)).
AddTokenAuth(tokenWithReadRepoScope)
MakeRequest(t, req, http.StatusOK)
})

t.Run("Watch", func(t *testing.T) {
defer tests.PrintCurrentTest(t)()

Expand Down

0 comments on commit 9bd8cdb

Please sign in to comment.