mysql_test.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package weeklyhonor
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestWeeklyhonorpingMySQL(t *testing.T) {
  8. convey.Convey("pingMySQL", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. )
  12. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  13. err := d.pingMySQL(c)
  14. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  15. ctx.So(err, convey.ShouldBeNil)
  16. })
  17. })
  18. })
  19. }
  20. func TestWeeklyhonorHonorLogs(t *testing.T) {
  21. convey.Convey("HonorLogs", t, func(ctx convey.C) {
  22. var (
  23. c = context.Background()
  24. mid = int64(0)
  25. )
  26. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  27. hls, err := d.HonorLogs(c, mid)
  28. ctx.Convey("Then err should be nil.hls should not be nil.", func(ctx convey.C) {
  29. ctx.So(err, convey.ShouldBeNil)
  30. ctx.So(hls, convey.ShouldNotBeNil)
  31. })
  32. })
  33. })
  34. }
  35. func TestWeeklyhonorUpsertCount(t *testing.T) {
  36. convey.Convey("UpsertCount", t, func(ctx convey.C) {
  37. var (
  38. c = context.Background()
  39. mid = int64(0)
  40. hid = int(0)
  41. )
  42. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  43. err := d.UpsertCount(c, mid, hid)
  44. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  45. ctx.So(err, convey.ShouldBeNil)
  46. })
  47. })
  48. })
  49. }
  50. func TestWeeklyhonorUpsertClickCount(t *testing.T) {
  51. convey.Convey("UpsertClickCount", t, func(ctx convey.C) {
  52. var (
  53. c = context.Background()
  54. mid = int64(500)
  55. )
  56. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  57. err := d.UpsertClickCount(c, mid)
  58. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  59. ctx.So(err, convey.ShouldBeNil)
  60. })
  61. })
  62. })
  63. }