service_test.go 706 B

123456789101112131415161718192021222324252627282930313233343536
  1. package v2
  2. import (
  3. "context"
  4. "flag"
  5. "testing"
  6. foo "go-common/app/interface/live/live-demo/api/http/v2"
  7. "go-common/app/interface/live/live-demo/conf"
  8. "go-common/app/interface/live/live-demo/dao"
  9. . "github.com/smartystreets/goconvey/convey"
  10. )
  11. var (
  12. s *FooService
  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 = NewFooService(conf.Conf)
  21. dao.InitAPI()
  22. }
  23. // go test -test.v -test.run TestService_GetInfo
  24. func TestService_GetInfo(t *testing.T) {
  25. Convey("TestService_GetInfo", t, func() {
  26. res, err := s.GetInfo(context.TODO(), &foo.GetInfoReq{RoomId: 10002})
  27. t.Logf("%v msg", res)
  28. So(err, ShouldBeNil)
  29. })
  30. }