dao_test.go 756 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package dao
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. "go-common/app/service/openplatform/ticket-sales/conf"
  8. "go-common/library/conf/paladin"
  9. "github.com/smartystreets/goconvey/convey"
  10. )
  11. var (
  12. d *Dao
  13. ctx context.Context
  14. )
  15. func init() {
  16. dir, _ := filepath.Abs("../cmd/ticket-sales.toml")
  17. flag.Set("conf", dir)
  18. flag.Set("appid", "open.ticket.sales")
  19. if err := paladin.Init(); err != nil {
  20. panic(err)
  21. }
  22. if err := paladin.Watch("ticket-sales.toml", conf.Conf); err != nil {
  23. panic(err)
  24. }
  25. d = New(conf.Conf)
  26. ctx = context.TODO()
  27. }
  28. func TestDatabusPub(t *testing.T) {
  29. convey.Convey("DatabusPub", t, func() {
  30. err := d.DatabusPub(context.TODO(), "aaa", []string{"masaji"})
  31. convey.So(err, convey.ShouldEqual, nil)
  32. })
  33. }