photoprism/internal/api/status_test.go

21 lines
445 B
Go
Raw Normal View History

2020-05-06 12:56:13 +02:00
package api
import (
"net/http"
"testing"
2020-11-21 18:08:41 +01:00
"github.com/stretchr/testify/assert"
"github.com/tidwall/gjson"
2020-05-06 12:56:13 +02:00
)
func TestGetStatus(t *testing.T) {
t.Run("successful request", func(t *testing.T) {
app, router, _ := NewApiTest()
GetStatus(router)
2020-05-06 12:56:13 +02:00
r := PerformRequest(app, "GET", "/api/v1/status")
val := gjson.Get(r.Body.String(), "status")
assert.Equal(t, "operational", val.String())
assert.Equal(t, http.StatusOK, r.Code)
})
}