展示点券/10 正常了

This commit is contained in:
yml2213
2026-08-08 00:57:32 +08:00
parent de23d87087
commit d04ce09384
2 changed files with 43 additions and 3 deletions
+30
View File
@@ -107,5 +107,35 @@ class XpdExchangeTests(unittest.TestCase):
self.assertEqual((second_params['page_begin'], second_params['page_num']), ('10', '2'))
def test_exchange_keeps_raw_price_from_goods_list(self):
self.client._request = Mock(side_effect=[
SimpleNamespace(
text='var recommend={"errcode":0,"data":{"client_data":{"itemsdetail":[{'
'"iGoodsId":"goods-1","sGoodsName":"测试商品","iPrice":"6800",'
'"iJb2Price":"0","iGoodsLeft":"-1"}]}}};',
),
SimpleNamespace(text='var buyInfo={"ret":"0","msg":"ok","serial":"order-1","newBalance":88};'),
])
goods = self.client.xpd_list_goods(
embed_query={}, act_id='46195', openid='openid', roleid='roleid',
)['goods']
result = self.client.xpd_exchange_goods(
embed_query={'code': 'fresh-code'},
act_id='46195',
rid='9263298',
commodity_id=goods[0]['commodity_id'],
price=goods[0]['price'],
picture='',
pay_type=1,
action_id='46195',
)
self.assertEqual(goods[0]['price'], 6800)
self.assertEqual(result['serial'], 'order-1')
params = self.client._request.call_args.kwargs['params']
self.assertEqual(json.loads(params['appext'])['user_price'], 6800)
if __name__ == '__main__':
unittest.main()