index_test.go 876 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package v1
  2. import (
  3. "context"
  4. "flag"
  5. "testing"
  6. . "github.com/smartystreets/goconvey/convey"
  7. api "go-common/app/interface/live/app-interface/api/http/v1"
  8. "go-common/app/interface/live/app-interface/conf"
  9. bm "go-common/library/net/http/blademaster"
  10. )
  11. var (
  12. s *Service
  13. )
  14. func init() {
  15. flag.Set("conf", "../../cmd/test.toml")
  16. var err error
  17. if err = conf.Init(); err != nil {
  18. panic(err)
  19. }
  20. s = New(conf.Conf)
  21. }
  22. // go test -test.v -test.run TestGetAllList
  23. func TestGetAllList(t *testing.T) {
  24. Convey("TestGetAllList", t, func() {
  25. res, err := s.GetAllList(&bm.Context{Context: context.TODO()}, &api.GetAllListReq{})
  26. t.Logf("%v", res)
  27. So(err, ShouldBeNil)
  28. })
  29. }
  30. func TestChange(t *testing.T) {
  31. Convey("TestChange", t, func() {
  32. res, err := s.Change(&bm.Context{Context: context.TODO()}, &api.ChangeReq{})
  33. t.Logf("%v", res)
  34. So(err, ShouldBeNil)
  35. })
  36. }