photoprism/internal/api/config_test.go

22 lines
455 B
Go
Raw Normal View History

package api
import (
"net/http"
"testing"
2020-11-21 18:08:41 +01:00
"github.com/tidwall/gjson"
"github.com/stretchr/testify/assert"
)
func TestGetConfig(t *testing.T) {
t.Run("successful request", func(t *testing.T) {
app, router, _ := NewApiTest()
GetConfig(router)
r := PerformRequest(app, "GET", "/api/v1/config")
val := gjson.Get(r.Body.String(), "flags")
assert.Equal(t, "public debug settings", val.String())
assert.Equal(t, http.StatusOK, r.Code)
})
}