2022-12-11 16:27:46 +01:00
|
|
|
package apis_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
2022-12-16 17:06:03 +02:00
|
|
|
|
|
|
|
"github.com/pocketbase/pocketbase/tests"
|
2022-12-11 16:27:46 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestHealthAPI(t *testing.T) {
|
2024-01-03 04:30:20 +02:00
|
|
|
t.Parallel()
|
|
|
|
|
2022-12-11 16:27:46 +01:00
|
|
|
scenarios := []tests.ApiScenario{
|
|
|
|
{
|
2024-02-10 10:59:39 +02:00
|
|
|
Name: "HEAD health status",
|
|
|
|
Method: http.MethodHead,
|
|
|
|
Url: "/api/health",
|
|
|
|
ExpectedStatus: 200,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "GET health status",
|
2022-12-11 16:27:46 +01:00
|
|
|
Method: http.MethodGet,
|
|
|
|
Url: "/api/health",
|
|
|
|
ExpectedStatus: 200,
|
|
|
|
ExpectedContent: []string{
|
|
|
|
`"code":200`,
|
2023-05-13 22:10:14 +03:00
|
|
|
`"data":{`,
|
|
|
|
`"canBackup":true`,
|
2022-12-11 16:27:46 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, scenario := range scenarios {
|
|
|
|
scenario.Test(t)
|
|
|
|
}
|
|
|
|
}
|