1
0
mirror of https://github.com/khorevaa/kubodin.git synced 2025-03-03 15:32:43 +02:00
kubodin/api/services_test.go
2021-03-04 16:09:08 +03:00

42 lines
831 B
Go

package api
import (
"github.com/khorevaa/kubodin/models"
"github.com/steinfletcher/apitest"
jsonpath "github.com/steinfletcher/apitest-jsonpath"
"github.com/stretchr/testify/suite"
"net/http"
"testing"
)
type servicesSuite struct {
baseSuite
}
func TestServiceTestSuite(t *testing.T) {
suite.Run(t, new(servicesSuite))
}
func (s *servicesSuite) SetupSuite() {
s.api().
Post("/api/v1/app").
JSON(&models.AppServer{
Name: "test",
Addr: "localhost",
Port: "1546",
}).
Expect(s.T()).
Assert(jsonpath.Equal(`$.message`, "success")).
Status(http.StatusOK).End()
}
func (s *servicesSuite) TestServiceList() {
s.api().
Debug().Report(apitest.SequenceDiagram()).
Get("/api/v1/app/test/services").
Expect(s.T()).
Assert(jsonpath.Equal(`$.message`, "success")).
Status(http.StatusOK).
End()
}