mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
You can now run "photoprism auth add" to create new client access tokens that allow external applications to use the built-in REST API. Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
@@ -13,7 +13,7 @@ func TestUpdateLabel(t *testing.T) {
|
||||
t.Run("successful request", func(t *testing.T) {
|
||||
app, router, _ := NewApiTest()
|
||||
UpdateLabel(router)
|
||||
r := PerformRequestWithBody(app, "PUT", "/api/v1/labels/lt9k3pw1wowuy3c7", `{"Name": "Updated01", "Priority": 2}`)
|
||||
r := PerformRequestWithBody(app, "PUT", "/api/v1/labels/ls6sg6b1wowuy3c7", `{"Name": "Updated01", "Priority": 2}`)
|
||||
val := gjson.Get(r.Body.String(), "Name")
|
||||
assert.Equal(t, "Updated01", val.String())
|
||||
val2 := gjson.Get(r.Body.String(), "CustomSlug")
|
||||
@@ -24,7 +24,7 @@ func TestUpdateLabel(t *testing.T) {
|
||||
t.Run("invalid request", func(t *testing.T) {
|
||||
app, router, _ := NewApiTest()
|
||||
UpdateLabel(router)
|
||||
r := PerformRequestWithBody(app, "PUT", "/api/v1/labels/lt9k3pw1wowuy3c7", `{"Name": 123, "Priority": 4, "Uncertainty": 80}`)
|
||||
r := PerformRequestWithBody(app, "PUT", "/api/v1/labels/ls6sg6b1wowuy3c7", `{"Name": 123, "Priority": 4, "Uncertainty": 80}`)
|
||||
assert.Equal(t, http.StatusBadRequest, r.Code)
|
||||
})
|
||||
|
||||
@@ -57,7 +57,7 @@ func TestLikeLabel(t *testing.T) {
|
||||
val := gjson.Get(r2.Body.String(), `#(Slug=="like-label").Favorite`)
|
||||
assert.Equal(t, "false", val.String())
|
||||
|
||||
r := PerformRequest(app, "POST", "/api/v1/labels/lt9k3pw1wowuy3c9/like")
|
||||
r := PerformRequest(app, "POST", "/api/v1/labels/ls6sg6b1wowuy3c9/like")
|
||||
t.Log(r.Body.String())
|
||||
assert.Equal(t, http.StatusOK, r.Code)
|
||||
|
||||
@@ -69,7 +69,7 @@ func TestLikeLabel(t *testing.T) {
|
||||
t.Run("like existing label with prio < 0", func(t *testing.T) {
|
||||
app, router, _ := NewApiTest()
|
||||
LikeLabel(router)
|
||||
r := PerformRequest(app, "POST", "/api/v1/labels/lt9k3pw1wowuy311/like")
|
||||
r := PerformRequest(app, "POST", "/api/v1/labels/ls6sg6b1wowuy311/like")
|
||||
t.Log(r.Body.String())
|
||||
assert.Equal(t, http.StatusOK, r.Code)
|
||||
})
|
||||
@@ -97,7 +97,7 @@ func TestDislikeLabel(t *testing.T) {
|
||||
val := gjson.Get(r2.Body.String(), `#(Slug=="landscape").Favorite`)
|
||||
assert.Equal(t, "true", val.String())
|
||||
|
||||
r := PerformRequest(app, "DELETE", "/api/v1/labels/lt9k3pw1wowuy3c2/like")
|
||||
r := PerformRequest(app, "DELETE", "/api/v1/labels/ls6sg6b1wowuy3c2/like")
|
||||
assert.Equal(t, http.StatusOK, r.Code)
|
||||
|
||||
r3 := PerformRequest(app, "GET", "/api/v1/labels?count=3&q=landscape")
|
||||
@@ -108,7 +108,7 @@ func TestDislikeLabel(t *testing.T) {
|
||||
t.Run("dislike existing label with prio < 0", func(t *testing.T) {
|
||||
app, router, _ := NewApiTest()
|
||||
DislikeLabel(router)
|
||||
r := PerformRequest(app, "DELETE", "/api/v1/labels/lt9k3pw1wowuy312/like")
|
||||
r := PerformRequest(app, "DELETE", "/api/v1/labels/ls6sg6b1wowuy312/like")
|
||||
assert.Equal(t, http.StatusOK, r.Code)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user