dao.cache_test.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package dao
  2. import (
  3. "context"
  4. "fmt"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaoBindInfoByMid(t *testing.T) {
  9. convey.Convey("BindInfoByMid", t, func(convCtx convey.C) {
  10. var (
  11. c = context.Background()
  12. id = int64(1)
  13. appID = int64(32)
  14. )
  15. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  16. _, err := d.BindInfoByMid(c, id, appID)
  17. convCtx.Convey("Then err should be nil.res should not be nil.", func(convCtx convey.C) {
  18. convCtx.So(err, convey.ShouldBeNil)
  19. })
  20. })
  21. })
  22. }
  23. func TestDaoOpenInfoByOpenID(t *testing.T) {
  24. convey.Convey("OpenInfoByOpenID", t, func(convCtx convey.C) {
  25. var (
  26. c = context.Background()
  27. id = "bdca8b71e7a6726885d40a395bf9ccd1"
  28. appID = int64(32)
  29. )
  30. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  31. res, err := d.OpenInfoByOpenID(c, id, appID)
  32. fmt.Println("res", res)
  33. convCtx.Convey("Then err should be nil.res should not be nil.", func(convCtx convey.C) {
  34. convCtx.So(err, convey.ShouldBeNil)
  35. })
  36. })
  37. })
  38. }