123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- package dao
- import (
- "context"
- "testing"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaocouponAllowancesKey(t *testing.T) {
- convey.Convey("couponAllowancesKey", t, func(convCtx convey.C) {
- var (
- mid = int64(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- p1 := couponAllowancesKey(mid, 0)
- convCtx.Convey("Then p1 should not be nil.", func(convCtx convey.C) {
- convCtx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaocouponsKey(t *testing.T) {
- convey.Convey("couponsKey", t, func(convCtx convey.C) {
- var (
- mid = int64(0)
- ct = int8(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- p1 := couponsKey(mid, ct)
- convCtx.Convey("Then p1 should not be nil.", func(convCtx convey.C) {
- convCtx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaograntUnique(t *testing.T) {
- convey.Convey("grantUnique", t, func(convCtx convey.C) {
- var (
- token = ""
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- p1 := grantUnique(token)
- convCtx.Convey("Then p1 should not be nil.", func(convCtx convey.C) {
- convCtx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoDelCouponAllowancesKey(t *testing.T) {
- convey.Convey("DelCouponAllowancesKey", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- err := d.DelCouponAllowancesKey(c, mid, 0)
- convCtx.Convey("Then err should be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaodelCache(t *testing.T) {
- convey.Convey("delCache", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- key = "123"
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- err := d.delCache(c, key)
- convCtx.Convey("Then err should be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoDelCouponTypeCache(t *testing.T) {
- convey.Convey("DelCouponTypeCache", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- ct = int8(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- err := d.DelCouponTypeCache(c, mid, ct)
- convCtx.Convey("Then err should be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoDelGrantUniqueLock(t *testing.T) {
- convey.Convey("DelGrantUniqueLock", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- token = ""
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- err := d.DelGrantUniqueLock(c, token)
- convCtx.Convey("Then err should be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoAddGrantUniqueLock(t *testing.T) {
- convey.Convey("AddGrantUniqueLock", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- token = ""
- seconds = int32(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- succeed := d.AddGrantUniqueLock(c, token, seconds)
- convCtx.Convey("Then succeed should not be nil.", func(convCtx convey.C) {
- convCtx.So(succeed, convey.ShouldNotBeNil)
- })
- })
- })
- }
|