label_test.go 697 B

12345678910111213141516171819202122232425262728293031
  1. package goblin
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/library/database/sql"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestGoblinLabel(t *testing.T) {
  9. var (
  10. c = context.Background()
  11. category = int(1)
  12. catType = int(1)
  13. )
  14. convey.Convey("Label", t, func(ctx convey.C) {
  15. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  16. res, err := d.Label(c, category, catType)
  17. ctx.So(err, convey.ShouldBeNil)
  18. ctx.So(res, convey.ShouldNotBeNil)
  19. })
  20. ctx.Convey("db closed", func(ctx convey.C) {
  21. d.db.Close()
  22. _, err := d.Label(c, category, catType)
  23. ctx.So(err, convey.ShouldNotBeNil)
  24. d.db = sql.NewMySQL(d.conf.Mysql)
  25. })
  26. })
  27. }