elec_test.go 743 B

1234567891011121314151617181920212223242526272829
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. "gopkg.in/h2non/gock.v1"
  7. )
  8. func TestDaoElecShow(t *testing.T) {
  9. convey.Convey("ElecShow", t, func(ctx convey.C) {
  10. var (
  11. c = context.Background()
  12. mid = int64(2089809)
  13. aid = int64(10100652)
  14. loginID = int64(2089809)
  15. )
  16. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  17. defer gock.OffAll()
  18. httpMock("GET", d.elecShowURL).Reply(200).JSON(`{"code":0,"data":{"show":true,"state":1}}`)
  19. rs, err := d.ElecShow(c, mid, aid, loginID)
  20. ctx.Convey("Then err should be nil.rs should not be nil.", func(ctx convey.C) {
  21. ctx.So(err, convey.ShouldBeNil)
  22. ctx.So(rs, convey.ShouldNotBeNil)
  23. })
  24. })
  25. })
  26. }