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

Related #28390
This commit is contained in:
KN4CK3R authored and GitHub committed 2023-12-21 23:59:59 +00:00
1 parent 04b235d094
commit 838db2f891
102 files changed
+1715 -1523

No files matched your search

+8 -4
View File
@@ -34,7 +34,8 @@ func TestAPIUpdateOrgAvatar(t *testing.T) {
Image: base64.StdEncoding.EncodeToString(avatar),
}
req := NewRequestWithJSON(t, "POST", "/api/v1/orgs/org3/avatar?token="+token, &opts)
req := NewRequestWithJSON(t, "POST", "/api/v1/orgs/org3/avatar", &opts).
AddTokenAuth(token)
MakeRequest(t, req, http.StatusNoContent)
// Test what happens if you don't have a valid Base64 string
@@ -42,7 +43,8 @@ func TestAPIUpdateOrgAvatar(t *testing.T) {
Image: "Invalid",
}
req = NewRequestWithJSON(t, "POST", "/api/v1/orgs/org3/avatar?token="+token, &opts)
req = NewRequestWithJSON(t, "POST", "/api/v1/orgs/org3/avatar", &opts).
AddTokenAuth(token)
MakeRequest(t, req, http.StatusBadRequest)
// Test what happens if you use a file that is not an image
@@ -56,7 +58,8 @@ func TestAPIUpdateOrgAvatar(t *testing.T) {
Image: base64.StdEncoding.EncodeToString(text),
}
req = NewRequestWithJSON(t, "POST", "/api/v1/orgs/org3/avatar?token="+token, &opts)
req = NewRequestWithJSON(t, "POST", "/api/v1/orgs/org3/avatar", &opts).
AddTokenAuth(token)
MakeRequest(t, req, http.StatusInternalServerError)
}
@@ -67,6 +70,7 @@ func TestAPIDeleteOrgAvatar(t *testing.T) {
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteOrganization)
req := NewRequest(t, "DELETE", "/api/v1/orgs/org3/avatar?token="+token)
req := NewRequest(t, "DELETE", "/api/v1/orgs/org3/avatar").
AddTokenAuth(token)
MakeRequest(t, req, http.StatusNoContent)
}