go-common/app/job/main/creative/service/service_test.go

41 lines
605 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
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)
})
}))
}