go-common/app/job/main/creative/service/service_test.go
2019-04-22 18:49:16 +08:00

41 lines
605 B
Go

package service
import (
"flag"
"path/filepath"
"testing"
"time"
"go-common/app/job/main/creative/conf"
. "github.com/smartystreets/goconvey/convey"
)
var (
s *Service
)
func init() {
dir, _ := filepath.Abs("../cmd/creative-job.toml")
flag.Set("conf", dir)
conf.Init()
s = New(conf.Conf)
time.Sleep(time.Second)
}
func WithService(f func(s *Service)) func() {
return func() {
Reset(func() {})
f(s)
}
}
func Test_Pub(t *testing.T) {
Convey("pub", t, WithService(func(s *Service) {
Convey("pub", func() {
err := s.pub(int64(2089809), 0, 1)
So(err, ShouldBeNil)
})
}))
}