Beispiel #1
0
 def test_getPostage_noRId(self):
     """获取邮费-未传receivedId"""
     # 获取商品列表中第一个商品
     goodsId = getGoodBase.get_goods(self)
     params = {'goods_id': goodsId, 'receive_id': ''}
     response = requests.post(self.base_url, params)
     result = response.json()
     print(result)
     self.assertEqual(result['error'], '参数错误')
 def test_getGoodsDetail_noToken(self):
     """商品详情-未传token"""
     #获取商品列表中第一个商品
     id=getGoodBase.get_goods(self)
     params={'access_token':'','goods_id':id}
     response = requests.post(self.base_url,params)
     result = response.json()
     print(result)
     self.assertEqual(result['data']['goods_id'],id)
 def test_createOrder(self):
     """创建订单"""
     #获取商品
     goodId = getGoodBase.get_goods(self)
     #该套餐详情
     gps = goodsPackage.get_gp(self)
     gp_id = gps[0]['gp_id']
     #收货地址
     relist = getReceiveListBase.get_receiveList(self)
     receive_id = relist['data']['list'][0]['receive_id']
     params = {
         'access_token': self.accsee_token,
         'goods_id': goodId,
         'num': 1,
         'pay_type': 'weixin',
         'receive_id': receive_id,
         'gp_id': gp_id
     }
     response = requests.post(self.base_url, params)
     result = response.json()
     print(result)
Beispiel #4
0
 def test_getPostage(self):
     """获取邮费"""
     # 查找收货地址列表第一个地址
     receive = getReceiveListBase.get_receiveList(self)
     receive_id = ''
     if len(receive['data']['list']) != 0:
         # 判断该收货地址是否为默认地址
         for i in range(len(receive['data']['list'])):
             is_default = receive['data']['list'][i]['is_default']
             receive_id = receive['data']['list'][i]['receive_id']
             if is_default == 0:
                 break
     else:
         #未查到收货地址,新增收货地址
         receive_id = addReceiveBase.addReceive(self)
     # 获取商品列表中第一个商品
     goodsId = getGoodBase.get_goods(self)
     params = {'goods_id': goodsId, 'receive_id': receive_id}
     response = requests.post(self.base_url, params)
     result = response.json()
     print(result)
     print("该地址邮为:", result['postage'])