123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- package dao
- import (
- "context"
- "go-common/app/service/main/passport-game/model"
- "testing"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaohit(t *testing.T) {
- var (
- mid = int64(1)
- )
- convey.Convey("hit", t, func(ctx convey.C) {
- p1 := hit(mid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoMemberInfo(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(1)
- )
- convey.Convey("MemberInfo", t, func(ctx convey.C) {
- res, err := d.MemberInfo(c, mid)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoApps(t *testing.T) {
- var (
- c = context.TODO()
- )
- convey.Convey("Apps", t, func(ctx convey.C) {
- res, err := d.Apps(c)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoAddToken(t *testing.T) {
- var (
- c = context.TODO()
- no = &model.Perm{}
- )
- convey.Convey("AddToken", t, func(ctx convey.C) {
- affected, err := d.AddToken(c, no)
- ctx.Convey("Then err should be nil.affected should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldNotBeNil)
- ctx.So(affected, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoUpdateToken(t *testing.T) {
- var (
- c = context.TODO()
- no = &model.Perm{}
- )
- convey.Convey("UpdateToken", t, func(ctx convey.C) {
- affected, err := d.UpdateToken(c, no)
- ctx.Convey("Then err should be nil.affected should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(affected, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoToken(t *testing.T) {
- var (
- c = context.TODO()
- accessToken = "123456"
- )
- convey.Convey("Token", t, func(ctx convey.C) {
- res, err := d.Token(c, accessToken)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoAsoAccount(t *testing.T) {
- var (
- c = context.TODO()
- identify = "123456"
- identifyHash = "654321"
- )
- convey.Convey("AsoAccount", t, func(ctx convey.C) {
- res, err := d.AsoAccount(c, identify, identifyHash)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoAccountInfo(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(1)
- )
- convey.Convey("AccountInfo", t, func(ctx convey.C) {
- res, err := d.AccountInfo(c, mid)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoTokenFromOtherRegion(t *testing.T) {
- var (
- c = context.TODO()
- accessToken = "123456"
- )
- convey.Convey("TokenFromOtherRegion", t, func(ctx convey.C) {
- res, err := d.TokenFromOtherRegion(c, accessToken)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldBeNil)
- })
- })
- }
|