redis_test.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoassetRelationKey(t *testing.T) {
  8. convey.Convey("assetRelationKey", t, func(ctx convey.C) {
  9. var (
  10. mid = int64(0)
  11. )
  12. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  13. p1 := assetRelationKey(mid)
  14. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  15. ctx.So(p1, convey.ShouldNotBeNil)
  16. })
  17. })
  18. })
  19. }
  20. func TestDaoassetRelationField(t *testing.T) {
  21. convey.Convey("assetRelationField", t, func(ctx convey.C) {
  22. var (
  23. oid = int64(0)
  24. otype = ""
  25. )
  26. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  27. p1 := assetRelationField(oid, otype)
  28. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  29. ctx.So(p1, convey.ShouldNotBeNil)
  30. })
  31. })
  32. })
  33. }
  34. func TestDaoDelCacheAssetRelationState(t *testing.T) {
  35. convey.Convey("DelCacheAssetRelationState", t, func(ctx convey.C) {
  36. var (
  37. c = context.Background()
  38. oid = int64(0)
  39. otype = ""
  40. mid = int64(0)
  41. )
  42. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  43. err := d.DelCacheAssetRelationState(c, oid, otype, mid)
  44. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  45. ctx.So(err, convey.ShouldBeNil)
  46. })
  47. })
  48. })
  49. }