This commit is contained in:
Nicolas
2026-06-14 23:12:03 +02:00
parent e9eb5151c1
commit a20006a81c
3 changed files with 3 additions and 21 deletions
+1 -7
View File
@@ -50,14 +50,8 @@ func TestAPIUpdateOrgAvatar(t *testing.T) {
MakeRequest(t, req, http.StatusBadRequest)
// Test what happens if you use a file that is not an image
text, err := os.ReadFile(filepath.Join(setting.GetGiteaTestSourceRoot(), "go.mod"))
assert.NoError(t, err)
if err != nil {
assert.FailNow(t, "Unable to open go.mod")
}
opts = api.UpdateUserAvatarOption{
Image: base64.StdEncoding.EncodeToString(text),
Image: base64.StdEncoding.EncodeToString([]byte("This is not an image")),
}
req = NewRequestWithJSON(t, "POST", "/api/v1/orgs/org3/avatar", &opts).
+1 -7
View File
@@ -54,14 +54,8 @@ func TestAPIUpdateRepoAvatar(t *testing.T) {
MakeRequest(t, req, http.StatusBadRequest)
// Test what happens if you use a file that is not an image
text, err := os.ReadFile(filepath.Join(setting.GetGiteaTestSourceRoot(), "go.mod"))
assert.NoError(t, err)
if err != nil {
assert.FailNow(t, "Unable to open go.mod")
}
opts = api.UpdateRepoAvatarOption{
Image: base64.StdEncoding.EncodeToString(text),
Image: base64.StdEncoding.EncodeToString([]byte("This is not an image")),
}
req = NewRequestWithJSON(t, "POST", fmt.Sprintf("/api/v1/repos/%s/%s/avatar", repo.OwnerName, repo.Name), &opts).
+1 -7
View File
@@ -50,14 +50,8 @@ func TestAPIUpdateUserAvatar(t *testing.T) {
MakeRequest(t, req, http.StatusBadRequest)
// Test what happens if you use a file that is not an image
text, err := os.ReadFile(filepath.Join(setting.GetGiteaTestSourceRoot(), "go.mod"))
assert.NoError(t, err)
if err != nil {
assert.FailNow(t, "Unable to open go.mod")
}
opts = api.UpdateUserAvatarOption{
Image: base64.StdEncoding.EncodeToString(text),
Image: base64.StdEncoding.EncodeToString([]byte("This is not an image")),
}
req = NewRequestWithJSON(t, "POST", "/api/v1/user/avatar", &opts).