batch_query_test.go 797 B

123456789101112131415161718192021222324252627282930313233343536
  1. package service
  2. import (
  3. "context"
  4. "encoding/json"
  5. "testing"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestService_batchQueryCloudByMid(t *testing.T) {
  9. once.Do(startService)
  10. Convey("batch query cloud by mid", t, func() {
  11. mids := []int64{88888970, 88894849}
  12. res, miss := s.batchQueryCloudByMid(context.TODO(), mids, 1)
  13. str, _ := json.Marshal(res)
  14. t.Logf("res: %s", str)
  15. So(len(miss), ShouldEqual, 0)
  16. So(len(res), ShouldEqual, 2)
  17. })
  18. }
  19. func TestService_batchQueryCloudByMidNonMiss(t *testing.T) {
  20. once.Do(startService)
  21. Convey("batch query cloud by mid", t, func() {
  22. mids := []int64{88888970, 88894849}
  23. res := s.batchQueryCloudNonMiss(context.TODO(), mids, 1001, 1)
  24. str, _ := json.Marshal(res)
  25. t.Logf("res: %s", str)
  26. So(len(res), ShouldEqual, 2)
  27. })
  28. }