photoprism/internal/api/users_avatar_test.go
Michael Mayer 837669f796 Auth: Extend account settings with user details and avatar upload #98
Signed-off-by: Michael Mayer <michael@photoprism.app>
2022-10-17 19:07:38 +02:00

22 lines
505 B
Go

package api
import (
"fmt"
"net/http"
"testing"
"github.com/stretchr/testify/assert"
"github.com/photoprism/photoprism/internal/entity"
)
func TestUploadUserAvatar(t *testing.T) {
t.Run("Forbidden", func(t *testing.T) {
app, router, _ := NewApiTest()
adminUid := entity.Admin.UserUID
reqUrl := fmt.Sprintf("/api/v1/users/%s/avatar", adminUid)
UploadUserAvatar(router)
r := PerformRequestWithBody(app, "POST", reqUrl, "{foo:123}")
assert.Equal(t, http.StatusBadRequest, r.Code)
})
}