shop_test.go 780 B

12345678910111213141516171819202122232425262728293031
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. "gopkg.in/h2non/gock.v1"
  7. )
  8. func TestDao_ShopInfo(t *testing.T) {
  9. convey.Convey("test get shop info", t, func(ctx convey.C) {
  10. mid := int64(27515399)
  11. defer gock.OffAll()
  12. httpMock("GET", d.shopURL).Reply(200).JSON(`{"code":0,"data":{"shop":{"id":111}}}`)
  13. data, err := d.ShopInfo(context.Background(), mid)
  14. convey.So(err, convey.ShouldBeNil)
  15. convey.Printf("%+v", data)
  16. })
  17. }
  18. func TestDao_ShopLink(t *testing.T) {
  19. convey.Convey("test shop link", t, func(ctx convey.C) {
  20. mid := int64(27515399)
  21. plat := 1
  22. data, err := d.ShopLink(context.Background(), mid, plat)
  23. convey.So(err, convey.ShouldBeNil)
  24. convey.So(data, convey.ShouldNotBeNil)
  25. convey.Printf("%+v", data)
  26. })
  27. }