12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- package dao
- import (
- "context"
- "fmt"
- "testing"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaoaccLoginKey(t *testing.T) {
- convey.Convey("accLoginKey", t, func(ctx convey.C) {
- var (
- mid = int64(1)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- p1 := accLoginKey(mid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldContainSubstring, fmt.Sprintf(_accLogin, mid))
- })
- })
- })
- }
- func TestDaoRemQueue(t *testing.T) {
- convey.Convey("RemQueue", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(1)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := d.RemQueue(c, mid)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoDelRedisCache(t *testing.T) {
- convey.Convey("DelRedisCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(1)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := d.DelRedisCache(c, mid)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoLoginCount(t *testing.T) {
- convey.Convey("LoginCount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(1)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- count, err := d.LoginCount(c, mid)
- ctx.Convey("Then err should be nil.count should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(count, convey.ShouldBeGreaterThanOrEqualTo, 0)
- })
- })
- })
- }
- func TestDaoFrozenTime(t *testing.T) {
- convey.Convey("FrozenTime", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(1)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- frozenTime, err := d.FrozenTime(c, mid)
- ctx.Convey("Then err should be nil.frozenTime should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(frozenTime, convey.ShouldBeGreaterThanOrEqualTo, 0)
- })
- })
- })
- }
|