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) {
|
2020-06-25 14:54:04 +02:00
|
|
|
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)
|
|
|
|
})
|
|
|
|
}
|