mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-06-01 15:00:02 +02:00
parent
04b235d094
commit
838db2f891
102 changed files with 1715 additions and 1523 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue