mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-05 10:26:15 +02:00
fixes
This commit is contained in:
@@ -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).
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user