mysql_test.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaohit(t *testing.T) {
  8. var (
  9. id = int64(0)
  10. )
  11. convey.Convey("hit", t, func(ctx convey.C) {
  12. p1 := hit(id)
  13. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  14. ctx.So(p1, convey.ShouldNotBeNil)
  15. })
  16. })
  17. }
  18. func TestDaotagUserHit(t *testing.T) {
  19. var (
  20. id = int64(0)
  21. )
  22. convey.Convey("tagUserHit", t, func(ctx convey.C) {
  23. p1 := tagUserHit(id)
  24. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  25. ctx.So(p1, convey.ShouldNotBeNil)
  26. })
  27. })
  28. }
  29. func TestDaoUserRelation(t *testing.T) {
  30. var (
  31. c = context.Background()
  32. mid = int64(0)
  33. fid = int64(0)
  34. )
  35. convey.Convey("UserRelation", t, func(ctx convey.C) {
  36. f, err := d.UserRelation(c, mid, fid)
  37. ctx.Convey("Then err should be nil.f should not be nil.", func(ctx convey.C) {
  38. ctx.So(err, convey.ShouldBeNil)
  39. ctx.So(f, convey.ShouldNotBeNil)
  40. })
  41. })
  42. }
  43. func TestDaoUserSetAchieveFlag(t *testing.T) {
  44. var (
  45. c = context.Background()
  46. mid = int64(0)
  47. flag = uint64(0)
  48. )
  49. convey.Convey("UserSetAchieveFlag", t, func(ctx convey.C) {
  50. p1, err := d.UserSetAchieveFlag(c, mid, flag)
  51. ctx.Convey("Then err should be nil.p1 should not be nil.", func(ctx convey.C) {
  52. ctx.So(err, convey.ShouldBeNil)
  53. ctx.So(p1, convey.ShouldNotBeNil)
  54. })
  55. })
  56. }