1
0
Fork 0
forked from forgejo/forgejo

Convert to url auth to header auth in tests (#28484)

Related #28390
This commit is contained in:
KN4CK3R 2023-12-22 00:59:59 +01:00 committed by GitHub
parent 04b235d094
commit 838db2f891
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
102 changed files with 1715 additions and 1523 deletions

View file

@ -218,11 +218,11 @@ func TestCantMergeConflict(t *testing.T) {
// Use API to create a conflicting pr
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)
req := NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls?token=%s", "user1", "repo1", token), &api.CreatePullRequestOption{
req := NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls", "user1", "repo1"), &api.CreatePullRequestOption{
Head: "conflict",
Base: "base",
Title: "create a conflicting pr",
})
}).AddTokenAuth(token)
session.MakeRequest(t, req, http.StatusCreated)
// Now this PR will be marked conflict - or at least a race will do - so drop down to pure code at this point...
@ -326,11 +326,11 @@ func TestCantMergeUnrelated(t *testing.T) {
// Use API to create a conflicting pr
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)
req := NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls?token=%s", "user1", "repo1", token), &api.CreatePullRequestOption{
req := NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls", "user1", "repo1"), &api.CreatePullRequestOption{
Head: "unrelated",
Base: "base",
Title: "create an unrelated pr",
})
}).AddTokenAuth(token)
session.MakeRequest(t, req, http.StatusCreated)
// Now this PR could be marked conflict - or at least a race may occur - so drop down to pure code at this point...