aboutsummaryrefslogtreecommitdiffstats
path: root/tests/integration/api_user_avatar_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_user_avatar_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_user_avatar_test.go')
-rw-r--r--tests/integration/api_user_avatar_test.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/integration/api_user_avatar_test.go b/tests/integration/api_user_avatar_test.go
index 807c119e2c..5b4546f150 100644
--- a/tests/integration/api_user_avatar_test.go
+++ b/tests/integration/api_user_avatar_test.go
@@ -35,14 +35,16 @@ func TestAPIUpdateUserAvatar(t *testing.T) {
Image: base64.StdEncoding.EncodeToString(avatar),
}
- req := NewRequestWithJSON(t, "POST", "/api/v1/user/avatar?token="+token, &opts)
+ req := NewRequestWithJSON(t, "POST", "/api/v1/user/avatar", &opts).
+ AddTokenAuth(token)
MakeRequest(t, req, http.StatusNoContent)
opts = api.UpdateUserAvatarOption{
Image: "Invalid",
}
- req = NewRequestWithJSON(t, "POST", "/api/v1/user/avatar?token="+token, &opts)
+ req = NewRequestWithJSON(t, "POST", "/api/v1/user/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 TestAPIUpdateUserAvatar(t *testing.T) {
Image: base64.StdEncoding.EncodeToString(text),
}
- req = NewRequestWithJSON(t, "POST", "/api/v1/user/avatar?token="+token, &opts)
+ req = NewRequestWithJSON(t, "POST", "/api/v1/user/avatar", &opts).
+ AddTokenAuth(token)
MakeRequest(t, req, http.StatusInternalServerError)
}
@@ -67,6 +70,7 @@ func TestAPIDeleteUserAvatar(t *testing.T) {
session := loginUser(t, normalUsername)
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteUser)
- req := NewRequest(t, "DELETE", "/api/v1/user/avatar?token="+token)
+ req := NewRequest(t, "DELETE", "/api/v1/user/avatar").
+ AddTokenAuth(token)
MakeRequest(t, req, http.StatusNoContent)
}