MCPcopy Index your code
hub / github.com/apache/dubbo-python2 / test_pc

Method test_pc

tests/dubbo_test.py:234–275  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

232 dubbo_cli.call('test4', [['你好', '我好'], [2, 3, 3, 3], array])
233
234 def test_pc(self):
235 zk = ZkRegister('172.21.4.71:2181')
236 spu_query_provider = DubboClient('com.qianmi.pc.item.api.spu.SpuQueryProvider', zk_register=zk)
237
238 channel = Object('com.qianmi.pc.base.api.constants.ChannelEnum', values={
239 'name': 'D2C'
240 })
241
242 spu_query_request = Object('com.qianmi.pc.item.api.spu.request.SpuQueryRequest')
243 spu_query_request['chainMasterId'] = 'A000000'
244 spu_query_request['channel'] = channel
245 spu_query_request['pageSize'] = 20
246 result = spu_query_provider.call('query', spu_query_request)
247 # pretty_print(result)
248 total = result['totalCount']
249 print total
250 print len(result['dataList'])
251
252 data_list = result['dataList']
253 for data in data_list:
254 spu_id = data['spuId']
255 spu_desc_request = Object('com.qianmi.pc.item.api.spu.request.SpuDescriptionGetRequest')
256 spu_desc_request['spuId'] = spu_id
257 print spu_id
258 spu_desc_request['chainMasterId'] = 'A000000'
259 pretty_print(spu_query_provider.call('getDescription', spu_desc_request))
260
261 for data in data_list:
262 spu_request = Object('com.qianmi.pc.item.api.spu.request.SpuGetRequest')
263 spu_request['chainMasterId'] = 'A000000'
264 spu_request['spuId'] = data['spuId']
265 spu_request['channelEnum'] = channel
266
267 pretty_print(spu_query_provider.call('getById', spu_request))
268
269 spu_ids = map(lambda spu: spu['spuId'], data_list)
270 spu_ids_request = Object('com.qianmi.pc.item.api.spu.request.SpuListByIdsRequest')
271 spu_ids_request['chainMasterId'] = 'A000000'
272 spu_ids_request['channelEnum'] = channel
273 spu_ids_request['spuIds'] = spu_ids
274 batch_spu_request = spu_query_provider.call('listByIds', spu_ids_request)
275 pretty_print(batch_spu_request)
276
277 def test_pc_es_center(self):
278 zk = ZkRegister('172.19.71.7:2181')

Callers

nothing calls this directly

Calls 5

callMethod · 0.95
ZkRegisterClass · 0.90
DubboClientClass · 0.90
ObjectClass · 0.90
pretty_printFunction · 0.70

Tested by

no test coverage detected