parameter_test.go 1012 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoGetAllParameter(t *testing.T) {
  8. convey.Convey("GetAllParameter", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. )
  12. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  13. parameters, err := d.GetAllParameter(c)
  14. ctx.Convey("Then err should be nil.parameters should not be nil.", func(ctx convey.C) {
  15. ctx.So(err, convey.ShouldBeNil)
  16. ctx.So(parameters, convey.ShouldNotBeNil)
  17. })
  18. })
  19. })
  20. }
  21. func TestDaoInsertParameter(t *testing.T) {
  22. convey.Convey("InsertParameter", t, func(ctx convey.C) {
  23. var (
  24. c = context.Background()
  25. val = "('wmaafans',100,'活跃粉丝数')"
  26. )
  27. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  28. rows, err := d.InsertParameter(c, val)
  29. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  30. ctx.So(err, convey.ShouldBeNil)
  31. ctx.So(rows, convey.ShouldNotBeNil)
  32. })
  33. })
  34. })
  35. }