oldvip_test.go 636 B

123456789101112131415161718192021222324
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. gock "gopkg.in/h2non/gock.v1"
  7. )
  8. func TestDaoOldFrozenChange(t *testing.T) {
  9. convey.Convey("OldFrozenChange success", t, func() {
  10. defer gock.OffAll()
  11. httpMock("GET", _frozenChange).Reply(200).JSON(`{"code":0}`)
  12. err := d.OldFrozenChange(context.TODO(), 7593623)
  13. convey.So(err, convey.ShouldBeNil)
  14. })
  15. convey.Convey("OldFrozenChange fail", t, func() {
  16. defer gock.OffAll()
  17. httpMock("GET", _frozenChange).Reply(200).JSON(`{"code":-400}`)
  18. err := d.OldFrozenChange(context.TODO(), 7593623)
  19. convey.So(err, convey.ShouldNotBeNil)
  20. })
  21. }