summaryrefslogtreecommitdiffstats
path: root/tests/integration/api_issue_subscription_test.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2023-12-22 00:59:59 +0100
committerGitHub <noreply@github.com>2023-12-21 23:59:59 +0000
commit838db2f8911690fa2115c6827ed73687db71bef1 (patch)
tree6c364eca7570962619d0e416dcc8b175331bbf2b /tests/integration/api_issue_subscription_test.go
parent04b235d094218b780b62f024b7ae9716ad2e633f (diff)
downloadgitea-838db2f8911690fa2115c6827ed73687db71bef1.tar.gz
gitea-838db2f8911690fa2115c6827ed73687db71bef1.zip
Convert to url auth to header auth in tests (#28484)
Related #28390
Diffstat (limited to 'tests/integration/api_issue_subscription_test.go')
-rw-r--r--tests/integration/api_issue_subscription_test.go20
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/integration/api_issue_subscription_test.go b/tests/integration/api_issue_subscription_test.go
index 28650a3375..7a716301c4 100644
--- a/tests/integration/api_issue_subscription_test.go
+++ b/tests/integration/api_issue_subscription_test.go
@@ -37,8 +37,8 @@ func TestAPIIssueSubscriptions(t *testing.T) {
testSubscription := func(issue *issues_model.Issue, isWatching bool) {
issueRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue.RepoID})
- urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues/%d/subscriptions/check?token=%s", issueRepo.OwnerName, issueRepo.Name, issue.Index, token)
- req := NewRequest(t, "GET", urlStr)
+ req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/%s/issues/%d/subscriptions/check", issueRepo.OwnerName, issueRepo.Name, issue.Index)).
+ AddTokenAuth(token)
resp := MakeRequest(t, req, http.StatusOK)
wi := new(api.WatchInfo)
DecodeJSON(t, resp, wi)
@@ -57,22 +57,26 @@ func TestAPIIssueSubscriptions(t *testing.T) {
testSubscription(issue5, false)
issue1Repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue1.RepoID})
- urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues/%d/subscriptions/%s?token=%s", issue1Repo.OwnerName, issue1Repo.Name, issue1.Index, owner.Name, token)
- req := NewRequest(t, "DELETE", urlStr)
+ urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues/%d/subscriptions/%s", issue1Repo.OwnerName, issue1Repo.Name, issue1.Index, owner.Name)
+ req := NewRequest(t, "DELETE", urlStr).
+ AddTokenAuth(token)
MakeRequest(t, req, http.StatusCreated)
testSubscription(issue1, false)
- req = NewRequest(t, "DELETE", urlStr)
+ req = NewRequest(t, "DELETE", urlStr).
+ AddTokenAuth(token)
MakeRequest(t, req, http.StatusOK)
testSubscription(issue1, false)
issue5Repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue5.RepoID})
- urlStr = fmt.Sprintf("/api/v1/repos/%s/%s/issues/%d/subscriptions/%s?token=%s", issue5Repo.OwnerName, issue5Repo.Name, issue5.Index, owner.Name, token)
- req = NewRequest(t, "PUT", urlStr)
+ urlStr = fmt.Sprintf("/api/v1/repos/%s/%s/issues/%d/subscriptions/%s", issue5Repo.OwnerName, issue5Repo.Name, issue5.Index, owner.Name)
+ req = NewRequest(t, "PUT", urlStr).
+ AddTokenAuth(token)
MakeRequest(t, req, http.StatusCreated)
testSubscription(issue5, true)
- req = NewRequest(t, "PUT", urlStr)
+ req = NewRequest(t, "PUT", urlStr).
+ AddTokenAuth(token)
MakeRequest(t, req, http.StatusOK)
testSubscription(issue5, true)
}