123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- package dao
- import (
- "context"
- "testing"
- "time"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaoAvgUtimeByUID(t *testing.T) {
- var (
- c = context.TODO()
- uid = int64(421)
- stime = time.Now()
- etime = time.Now()
- )
- convey.Convey("AvgUtimeByUID", t, func(ctx convey.C) {
- utime, err := d.AvgUtimeByUID(c, uid, stime, etime)
- ctx.Convey("Then err should be nil.utime should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(utime, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoSumDurationByUID(t *testing.T) {
- var (
- c = context.TODO()
- uid = int64(421)
- stime = time.Now()
- etime = time.Now()
- )
- convey.Convey("SumDurationByUID", t, func(ctx convey.C) {
- duration, err := d.SumDurationByUID(c, uid, stime, etime)
- ctx.Convey("Then err should be nil.duration should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(duration, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoActionCountByUID(t *testing.T) {
- var (
- c = context.TODO()
- uid = int64(421)
- stime = time.Now()
- etime = time.Now()
- )
- convey.Convey("ActionCountByUID", t, func(ctx convey.C) {
- mapAction, err := d.ActionCountByUID(c, uid, stime, etime)
- ctx.Convey("Then err should be nil.mapAction should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(mapAction, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoPassCountByUID(t *testing.T) {
- var (
- c = context.TODO()
- uid = int64(421)
- stime = time.Now()
- etime = time.Now()
- )
- convey.Convey("PassCountByUID", t, func(ctx convey.C) {
- count, err := d.PassCountByUID(c, uid, stime, etime)
- 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.ShouldNotBeNil)
- })
- })
- }
- func TestDaoSubjectCountByUID(t *testing.T) {
- var (
- c = context.TODO()
- uid = int64(421)
- stime = time.Now()
- etime = time.Now()
- )
- convey.Convey("SubjectCountByUID", t, func(ctx convey.C) {
- count, err := d.SubjectCountByUID(c, uid, stime, etime)
- 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.ShouldNotBeNil)
- })
- })
- }
- func TestDaoActiveUids(t *testing.T) {
- var (
- c = context.TODO()
- stime = time.Now().AddDate(-1, 0, 0)
- etime = time.Now()
- )
- convey.Convey("ActiveUids", t, func(ctx convey.C) {
- _, err := d.ActiveUids(c, stime, etime)
- ctx.Convey("Then err should be nil.uids should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
|