white_test.go 566 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package white
  2. import (
  3. "flag"
  4. "path/filepath"
  5. "testing"
  6. "time"
  7. "go-common/app/interface/main/app-resource/conf"
  8. . "github.com/smartystreets/goconvey/convey"
  9. )
  10. var (
  11. s *Service
  12. )
  13. func WithService(f func(s *Service)) func() {
  14. return func() {
  15. f(s)
  16. }
  17. }
  18. func init() {
  19. dir, _ := filepath.Abs("../../cmd/app-resource-test.toml")
  20. flag.Set("conf", dir)
  21. conf.Init()
  22. s = New(conf.Conf)
  23. time.Sleep(time.Second)
  24. }
  25. func TestList(t *testing.T) {
  26. Convey("get List data", t, WithService(func(s *Service) {
  27. res := s.List()
  28. So(res, ShouldNotBeEmpty)
  29. }))
  30. }