2020-05-06 10:56:13 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
2020-11-21 17:08:41 +00:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/tidwall/gjson"
|
2020-05-06 10:56:13 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestGetStatus(t *testing.T) {
|
|
|
|
t.Run("successful request", func(t *testing.T) {
|
2020-06-25 12:54:04 +00:00
|
|
|
app, router, _ := NewApiTest()
|
|
|
|
GetStatus(router)
|
2020-05-06 10:56:13 +00: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)
|
|
|
|
})
|
|
|
|
}
|