Arthur-Wu committed this file on 2024-11-21
This commit is contained in:
@ -22,7 +22,7 @@ class Test_CAnon002(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.NormalGoodsInputcode01 = NormalGoodsInputcode01 # 乐事薯片
|
||||
self.NormalGoodsInputcode01 = NormalGoodsInputcode01
|
||||
|
||||
def test_CAnon002_AddNonDiscountedProductsForPurchase(self):
|
||||
allure.dynamic.description(f"描述:{DescName}")
|
||||
|
@ -22,8 +22,7 @@ class Test_CAnon003(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
# 会员有优惠商品暂未提供
|
||||
self.vip_goods_inputcode = VipGoodsInputcode # 统一番茄牛肉面
|
||||
self.vip_goods_inputcode = VipGoodsInputcode
|
||||
|
||||
def test_CAnon003_AddMemberProductsForPurchase(self):
|
||||
allure.dynamic.description(f"描述:{DescName}")
|
||||
|
@ -21,8 +21,8 @@ class Test_CAnon004(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.goods_inputcode1 = NormalGoodsInputcode01 # 乐事薯片
|
||||
self.goods_inputcode2 = NormalGoodsInputcode02 # 统一番茄牛肉面
|
||||
self.goods_inputcode1 = NormalGoodsInputcode01
|
||||
self.goods_inputcode2 = NormalGoodsInputcode02
|
||||
|
||||
def test_CAnon004_AddMultipleItemsForPurchase(self):
|
||||
allure.dynamic.description(f"描述:{DescName}")
|
||||
|
@ -22,8 +22,7 @@ class Test_CAnon005(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
# 折扣商品暂未提供
|
||||
self.sale_goods_inputCode = SaleGoodsInputCode # 乐事薯片
|
||||
self.sale_goods_inputCode = SaleGoodsInputCode
|
||||
|
||||
def test_CAnon005_AddDiscountedProductsForPurchase(self):
|
||||
allure.dynamic.description(f"描述:{DescName}")
|
||||
|
@ -24,7 +24,6 @@ class Test_CAnon006(unittest.TestCase):
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.yms = YMServiceApi()
|
||||
# 促销白名单商品暂未提供
|
||||
self.promotional_whitelist_goods = PromotionalWhitelistGoods
|
||||
self.market_and_store_info = {
|
||||
"MarketId": MarketAndStoreDetails["putMarketId"],
|
||||
|
@ -24,7 +24,6 @@ class Test_CAnon007(unittest.TestCase):
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.yms = YMServiceApi()
|
||||
# 重量放通白名单商品暂未提供
|
||||
self.weight_to_whitelist_goods = WeightToWhitelistGoods
|
||||
self.market_and_store_info = {
|
||||
"MarketId": MarketAndStoreDetails["putMarketId"],
|
||||
|
@ -21,8 +21,8 @@ class Test_CAnon008(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.shoppingbag_mid = GoodsBagInputcode_mid # 乐事薯片
|
||||
self.shoppingbag_max = GoodsBagInputcode_max # 统一番茄牛肉面
|
||||
self.shoppingbag_mid = GoodsBagInputcode_mid
|
||||
self.shoppingbag_max = GoodsBagInputcode_max
|
||||
|
||||
def test_CAnon008_ReturnShoppingBag(self):
|
||||
allure.dynamic.description(f"描述:{DescName}")
|
||||
|
@ -21,8 +21,8 @@ class Test_CAnon009(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.goods_01 = NormalGoodsInputcode01 # 乐事薯片
|
||||
self.goods_02 = NormalGoodsInputcode02 # 统一番茄牛肉面
|
||||
self.goods_01 = NormalGoodsInputcode01
|
||||
self.goods_02 = NormalGoodsInputcode02
|
||||
|
||||
def test_CAnon009_ReturnPurchaseOfOrdinaryGoods(self):
|
||||
allure.dynamic.description(f"描述:{DescName}")
|
||||
|
@ -21,8 +21,8 @@ class Test_CAnon010(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.vip_goods_01 = VipGoodsInputcode # 乐事薯片
|
||||
self.vip_goods_02 = VipGoodsInputcode02 # 统一番茄牛肉面
|
||||
self.vip_goods_01 = VipGoodsInputcode
|
||||
self.vip_goods_02 = VipGoodsInputcode02
|
||||
|
||||
def test_CAnon010_ReturnOfMemberProducts(self):
|
||||
allure.dynamic.description(f"描述:{DescName}")
|
||||
|
@ -21,8 +21,8 @@ class Test_CAnon011(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.goods_inputcode1 = NormalGoodsInputcode01 # 乐事薯片
|
||||
self.goods_inputcode2 = NormalGoodsInputcode02 # 统一番茄牛肉面
|
||||
self.goods_inputcode1 = NormalGoodsInputcode01
|
||||
self.goods_inputcode2 = NormalGoodsInputcode02
|
||||
|
||||
def test_CAnon011_ReturnOneItemFromMultiplePurchases(self):
|
||||
allure.dynamic.description(f"描述:{DescName}")
|
||||
|
@ -21,7 +21,7 @@ class Test_CAnon012(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.sale_goods_inputCode = SaleGoodsInputCode # 乐事薯片
|
||||
self.sale_goods_inputCode = SaleGoodsInputCode
|
||||
|
||||
def test_CAnon012_ReturnOfDiscountedProducts(self):
|
||||
allure.dynamic.description(f"描述:{DescName}")
|
||||
|
@ -23,7 +23,6 @@ class Test_CAnon013(unittest.TestCase):
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.yms = YMServiceApi()
|
||||
# 促销白名单商品暂未提供
|
||||
self.promotional_whitelist_goods = PromotionalWhitelistGoods
|
||||
self.market_and_store_info = {
|
||||
"MarketId": MarketAndStoreDetails["putMarketId"],
|
||||
@ -69,15 +68,15 @@ class Test_CAnon013(unittest.TestCase):
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.promotional_whitelist_goods["GoodsInputcode"]} 不存在")
|
||||
pytest.fail(f"---商品 {self.promotional_whitelist_goods["GoodsInputcode"]} 不存在")
|
||||
|
||||
allure.step("[后置处理]:删除添加的促销白名单商品")
|
||||
self.yms.delete_whitelist_goods()
|
||||
else:
|
||||
LOGGER.info(f"---添加商品 {self.promotional_whitelist_goods['GoodsInputcode']} "
|
||||
f"到促销白名单失败")
|
||||
pytest.fail(f"---添加商品 {self.promotional_whitelist_goods['GoodsInputcode']} "
|
||||
f"到促销白名单失败")
|
||||
f"到促销白名单失败")
|
||||
|
||||
def tearDown(self) -> None:
|
||||
allure.step("[后置处理]:删除添加的促销白名单商品")
|
||||
self.yms.delete_whitelist_goods()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2)
|
@ -23,7 +23,6 @@ class Test_CAnon014(unittest.TestCase):
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.yms = YMServiceApi()
|
||||
# 重量放通白名单商品暂未提供
|
||||
self.weight_to_whitelist_goods = WeightToWhitelistGoods
|
||||
self.market_and_store_info = {
|
||||
"MarketId": MarketAndStoreDetails["putMarketId"],
|
||||
@ -69,15 +68,15 @@ class Test_CAnon014(unittest.TestCase):
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.weight_to_whitelist_goods["GoodsInputcode"]} 不存在")
|
||||
pytest.fail(f"---商品 {self.weight_to_whitelist_goods['GoodsInputcode']} 不存在")
|
||||
|
||||
allure.step("[后置处理]:删除添加的重量放通白名单商品")
|
||||
self.yms.delete_weight_whitelist_goods()
|
||||
else:
|
||||
LOGGER.info(f"---添加商品 {self.weight_to_whitelist_goods['GoodsInputcode']} "
|
||||
f"到重量放通白名单失败")
|
||||
pytest.fail(f"---添加商品 {self.weight_to_whitelist_goods['GoodsInputcode']} "
|
||||
f"到重量放通白名单失败")
|
||||
|
||||
def tearDown(self) -> None:
|
||||
allure.step("[后置处理]:删除添加的重量放通白名单商品")
|
||||
self.yms.delete_weight_whitelist_goods()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2)
|
@ -0,0 +1,47 @@
|
||||
# !/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# @Author:: Arthur Wu
|
||||
# @Description:: 匿名登录,加购计件商品,并结算
|
||||
# @Date:: 2024/11/22
|
||||
import unittest,allure,time,pytest
|
||||
from configs.globalObj import LOGGER
|
||||
from YiMao.businessFunc.ClientApiLib import YMClientApi
|
||||
from YiMao.data.WuShangSceneTestData import *
|
||||
|
||||
|
||||
DescName = "Anon015-匿名登录加购计件商品,并结算"
|
||||
@allure.story(f'[场景测试] {DescName}验证')
|
||||
class Test_CAnon015(unittest.TestCase):
|
||||
f'''@Date:: 2024/11/22
|
||||
@Author:: Arthur Wu
|
||||
@Desc::
|
||||
[购物车客户端] {DescName}
|
||||
'''
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.piece_rate_goods = PieceRateGoods["GoodsInputcode"]
|
||||
|
||||
def test_CAnon015(self):
|
||||
allure.dynamic.description(f"描述:{DescName}\n")
|
||||
allure.step("步骤1:session开始")
|
||||
self.ymc.session_start()
|
||||
allure.step("步骤2:匿名登录")
|
||||
Payload01 = {"action": 0, "isAnon": True}
|
||||
LoginData = self.ymc.login_app_v2(Payload01)
|
||||
allure.step("步骤3:获取商品信息")
|
||||
GetGoodsInfoResp_01 = self.ymc.get_goods_info(self.piece_rate_goods)
|
||||
if GetGoodsInfoResp_01['msg'] != '加购商品不存在':
|
||||
allure.step("步骤4:添加会员有优惠商品")
|
||||
self.ymc.add_cart_goods(GetGoodsInfoResp_01, 1, LoginData)
|
||||
allure.step("步骤5:获取购物车商品信息")
|
||||
self.ymc.get_cart_goods_info([GetGoodsInfoResp_01])
|
||||
allure.step("步骤6:请求订单结算")
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {PieceRateGoods} 不存在")
|
||||
pytest.fail(f"---商品 {PieceRateGoods} 不存在")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2)
|
@ -0,0 +1,55 @@
|
||||
# !/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# @Author:: Arthur Wu
|
||||
# @Description:: 匿名登录,加购计件商品,并退购
|
||||
# @Date:: 2024/11/22
|
||||
import unittest,allure,time,pytest
|
||||
from configs.globalObj import LOGGER
|
||||
from YiMao.businessFunc.ClientApiLib import YMClientApi
|
||||
from YiMao.data.WuShangSceneTestData import *
|
||||
|
||||
|
||||
DescName = "Anon016-匿名登录,加购计件商品,并退购"
|
||||
@allure.story(f'[场景测试] {DescName}验证')
|
||||
class Test_CAnon016(unittest.TestCase):
|
||||
f'''@Date:: 2024/11/22
|
||||
@Author:: Arthur Wu
|
||||
@Desc::
|
||||
[购物车客户端] {DescName}
|
||||
1、步骤
|
||||
1)加购计件或计重商品
|
||||
2)退购一件
|
||||
'''
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.piece_rate_goods = PieceRateGoods["GoodsInputcode"]
|
||||
|
||||
def test_CAnon016(self):
|
||||
allure.dynamic.description(f"描述:{DescName}\n")
|
||||
allure.step("步骤1:session开始")
|
||||
self.ymc.session_start()
|
||||
allure.step("步骤2:匿名登录")
|
||||
Payload01 = {"action": 0, "isAnon": True}
|
||||
LoginData = self.ymc.login_app_v2(Payload01)
|
||||
allure.step("步骤3:获取商品信息")
|
||||
GetGoodsInfoResp_01 = self.ymc.get_goods_info(self.piece_rate_goods)
|
||||
if GetGoodsInfoResp_01['msg'] != '加购商品不存在':
|
||||
allure.step("步骤4:添加会员有优惠商品")
|
||||
AddGoodsResp = self.ymc.add_cart_goods(GetGoodsInfoResp_01, 1, LoginData)
|
||||
|
||||
allure.step("\n步骤7:退购一件商品")
|
||||
GetGoodsInfoList = [GetGoodsInfoResp_01]
|
||||
self.ymc.delete_cart_goods(GetGoodsInfoList, LoginData, AddGoodsResp)
|
||||
|
||||
allure.step("步骤5:获取购物车商品信息")
|
||||
self.ymc.get_cart_goods_info([GetGoodsInfoResp_01])
|
||||
allure.step("步骤6:请求订单结算")
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {PieceRateGoods} 不存在")
|
||||
pytest.fail(f"---商品 {PieceRateGoods} 不存在")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2)
|
@ -0,0 +1,47 @@
|
||||
# !/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# @Author:: Arthur Wu
|
||||
# @Description:: 匿名登录,加购计重商品,并结算
|
||||
# @Date:: 2024/11/22
|
||||
import unittest,allure,time,pytest
|
||||
from configs.globalObj import LOGGER
|
||||
from YiMao.businessFunc.ClientApiLib import YMClientApi
|
||||
from YiMao.data.WuShangSceneTestData import *
|
||||
|
||||
|
||||
DescName = "Anon017-匿名登录,加购计重商品,并结算"
|
||||
@allure.story(f'[场景测试] {DescName}验证')
|
||||
class Test_CAnon017(unittest.TestCase):
|
||||
f'''@Date:: 2024/11/22
|
||||
@Author:: Arthur Wu
|
||||
@Desc::
|
||||
[购物车客户端] {DescName}
|
||||
'''
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.bulk_goods = BulkGoods["GoodsInputcode"]
|
||||
|
||||
def test_CAnon017(self):
|
||||
allure.dynamic.description(f"描述:{DescName}\n")
|
||||
allure.step("步骤1:session开始")
|
||||
self.ymc.session_start()
|
||||
allure.step("步骤2:匿名登录")
|
||||
Payload01 = {"action": 0, "isAnon": True}
|
||||
LoginData = self.ymc.login_app_v2(Payload01)
|
||||
allure.step("步骤3:获取商品信息")
|
||||
GetGoodsInfoResp_01 = self.ymc.get_goods_info(self.bulk_goods)
|
||||
if GetGoodsInfoResp_01['msg'] != '加购商品不存在':
|
||||
allure.step("步骤4:添加会员有优惠商品")
|
||||
self.ymc.add_cart_goods(GetGoodsInfoResp_01, 1, LoginData)
|
||||
allure.step("步骤5:获取购物车商品信息")
|
||||
self.ymc.get_cart_goods_info([GetGoodsInfoResp_01])
|
||||
allure.step("步骤6:请求订单结算")
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {BulkGoods} 不存在")
|
||||
pytest.fail(f"---商品 {BulkGoods} 不存在")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2)
|
@ -0,0 +1,55 @@
|
||||
# !/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# @Author:: Arthur Wu
|
||||
# @Description:: 匿名登录,加购计重商品,并退购
|
||||
# @Date:: 2024/11/21
|
||||
import unittest,allure,time,pytest
|
||||
from configs.globalObj import LOGGER
|
||||
from YiMao.businessFunc.ClientApiLib import YMClientApi
|
||||
from YiMao.data.WuShangSceneTestData import *
|
||||
|
||||
|
||||
DescName = "Anon018-匿名登录,加购计重商品,并退购"
|
||||
@allure.story(f'[场景测试] {DescName}验证')
|
||||
class Test_CAnon018(unittest.TestCase):
|
||||
f'''@Date:: 2024/11/15
|
||||
@Author:: Arthur Wu
|
||||
@Desc::
|
||||
[购物车客户端] {DescName}
|
||||
1、步骤
|
||||
1)加购计件或计重商品
|
||||
2)退购一件
|
||||
'''
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.bulk_goods = BulkGoods["GoodsInputcode"]
|
||||
|
||||
def test_CAnon018(self):
|
||||
allure.dynamic.description(f"描述:{DescName}\n")
|
||||
allure.step("步骤1:session开始")
|
||||
self.ymc.session_start()
|
||||
allure.step("步骤2:匿名登录")
|
||||
Payload01 = {"action": 0, "isAnon": True}
|
||||
LoginData = self.ymc.login_app_v2(Payload01)
|
||||
allure.step("步骤3:获取商品信息")
|
||||
GetGoodsInfoResp_01 = self.ymc.get_goods_info(self.bulk_goods)
|
||||
if GetGoodsInfoResp_01['msg'] != '加购商品不存在':
|
||||
allure.step("步骤4:添加会员有优惠商品")
|
||||
AddGoodsResp = self.ymc.add_cart_goods(GetGoodsInfoResp_01, 1, LoginData)
|
||||
|
||||
allure.step("\n步骤5:退购一件商品")
|
||||
GetGoodsInfoList = [GetGoodsInfoResp_01]
|
||||
self.ymc.delete_cart_goods(GetGoodsInfoList, LoginData, AddGoodsResp)
|
||||
|
||||
allure.step("步骤6:获取购物车商品信息")
|
||||
self.ymc.get_cart_goods_info([GetGoodsInfoResp_01])
|
||||
allure.step("步骤7:请求订单结算")
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {BulkGoods} 不存在")
|
||||
pytest.fail(f"---商品 {BulkGoods} 不存在")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2)
|
@ -24,13 +24,17 @@ class Test_CNoLogin001(unittest.TestCase):
|
||||
def test_CNoLogin001_CheckADs(self):
|
||||
allure.dynamic.description(f"描述:{DescName}")
|
||||
AdListData = self.ymc.get_ads_list()
|
||||
if "error_msg" not in AdListData:
|
||||
adIdList = []
|
||||
for ad in AdListData['data']:
|
||||
adIdList.append(ad['id'])
|
||||
LOGGER.info(f"---adIdList: {adIdList}---\n")
|
||||
for adId in adIdList:
|
||||
self.ymc.query_ad_detail(str(adId))
|
||||
if AdListData['data'] != []:
|
||||
if "error_msg" not in AdListData:
|
||||
adIdList = []
|
||||
for ad in AdListData['data']:
|
||||
adIdList.append(ad['id'])
|
||||
LOGGER.info(f"---adIdList: {adIdList}---\n")
|
||||
for adId in adIdList:
|
||||
self.ymc.query_ad_detail(str(adId))
|
||||
else:
|
||||
LOGGER.info(f"---该商超未配置广告---\n")
|
||||
pytest.fail(f"---该商超未配置广告---\n")
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2)
|
@ -49,6 +49,7 @@ class Test_CVip001_AddShoppingBagAndSettlePayment(unittest.TestCase):
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---购物袋 {self.goodsbag_mid} 不存在")
|
||||
pytest.fail(f"---购物袋 {self.goodsbag_mid} 不存在")
|
||||
|
||||
def test_CVip00102_AddMaxShoppingbagsForPurchase(self):
|
||||
allure.dynamic.description("描述:加购大号购物袋")
|
||||
@ -73,7 +74,7 @@ class Test_CVip001_AddShoppingBagAndSettlePayment(unittest.TestCase):
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---购物袋 {self.goodsbag_max} 不存在")
|
||||
raise Exception(f"购物袋 {self.goodsbag_max} 不存在")
|
||||
pytest.fail(f"购物袋 {self.goodsbag_max} 不存在")
|
||||
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@ class Test_CVip002(unittest.TestCase):
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.vip_phone_num = VIPPhoneNumber
|
||||
self.NormalGoodsInputcode01 = NormalGoodsInputcode01 # 乐事薯片
|
||||
self.NormalGoodsInputcode01 = NormalGoodsInputcode01
|
||||
|
||||
def test_CVip002_AddNonDiscountedProductsForPurchase(self):
|
||||
allure.dynamic.description(f"描述:{DescName}")
|
||||
@ -48,7 +48,7 @@ class Test_CVip002(unittest.TestCase):
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.NormalGoodsInputcode01} 不存在")
|
||||
raise Exception(f"---商品 {self.NormalGoodsInputcode01} 不存在")
|
||||
pytest.fail(f"---商品 {self.NormalGoodsInputcode01} 不存在")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -22,9 +22,8 @@ class Test_CVip003(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
# 会员有优惠商品暂未提供
|
||||
self.vip_phone_num = VIPPhoneNumber
|
||||
self.vip_goods_inputcode = VipGoodsInputcode # 统一番茄牛肉面
|
||||
self.vip_goods_inputcode = VipGoodsInputcode
|
||||
|
||||
def test_CVip003_AddMemberProductsForPurchase(self):
|
||||
allure.dynamic.description(f"描述:{DescName}")
|
||||
@ -49,7 +48,7 @@ class Test_CVip003(unittest.TestCase):
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.vip_goods_inputcode} 不存在")
|
||||
raise Exception(f"---商品 {self.vip_goods_inputcode} 不存在")
|
||||
pytest.fail(f"---商品 {self.vip_goods_inputcode} 不存在")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -22,8 +22,8 @@ class Test_CVip004(unittest.TestCase):
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.vip_phone_num = VIPPhoneNumber
|
||||
self.goods_inputcode1 = NormalGoodsInputcode01 # 乐事薯片
|
||||
self.goods_inputcode2 = NormalGoodsInputcode02 # 统一番茄牛肉面
|
||||
self.goods_inputcode1 = NormalGoodsInputcode01
|
||||
self.goods_inputcode2 = NormalGoodsInputcode02
|
||||
|
||||
def test_CVip004_AddMultipleItemsForPurchase(self):
|
||||
allure.dynamic.description(f"描述:{DescName}")
|
||||
@ -53,10 +53,10 @@ class Test_CVip004(unittest.TestCase):
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.goods_inputcode2} 不存在")
|
||||
raise AssertionError(f"---商品 {self.goods_inputcode2} 不存在")
|
||||
pytest.fail(f"---商品 {self.goods_inputcode2} 不存在")
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.goods_inputcode1} 不存在")
|
||||
raise AssertionError(f"---商品 {self.goods_inputcode1} 不存在")
|
||||
pytest.fail(f"---商品 {self.goods_inputcode1} 不存在")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -22,9 +22,8 @@ class Test_CVip005(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
# 折扣商品暂未提供
|
||||
self.vip_phone_num = VIPPhoneNumber
|
||||
self.sale_goods_inputCode = SaleGoodsInputCode # 乐事薯片
|
||||
self.sale_goods_inputCode = SaleGoodsInputCode
|
||||
|
||||
def test_CVip005_AddDiscountedProductsForPurchase(self):
|
||||
allure.dynamic.description(f"描述:{DescName}")
|
||||
@ -49,7 +48,7 @@ class Test_CVip005(unittest.TestCase):
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.sale_goods_inputCode} 不存在")
|
||||
raise Exception(f"---商品 {self.sale_goods_inputCode} 不存在")
|
||||
pytest.fail(f"---商品 {self.sale_goods_inputCode} 不存在")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -24,7 +24,6 @@ class Test_CVip006(unittest.TestCase):
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.yms = YMServiceApi()
|
||||
# 促销白名单商品暂未提供
|
||||
self.vip_phone_num = VIPPhoneNumber
|
||||
self.promotional_whitelist_goods = PromotionalWhitelistGoods
|
||||
self.market_and_store_info = {
|
||||
@ -63,14 +62,14 @@ class Test_CVip006(unittest.TestCase):
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.promotional_whitelist_goods["GoodsInputcode"]} 不存在")
|
||||
raise Exception(f"商品 {self.promotional_whitelist_goods["GoodsInputcode"]}不存在")
|
||||
pytest.fail(f"商品 {self.promotional_whitelist_goods["GoodsInputcode"]}不存在")
|
||||
|
||||
allure.step("[后置处理]:删除添加的促销白名单商品")
|
||||
self.yms.delete_whitelist_goods()
|
||||
else:
|
||||
LOGGER.info(f"---添加商品 {self.promotional_whitelist_goods['GoodsInputcode']} "
|
||||
f"到促销白名单失败")
|
||||
raise Exception(f"---添加商品 {self.promotional_whitelist_goods['GoodsInputcode']} "
|
||||
pytest.fail(f"---添加商品 {self.promotional_whitelist_goods['GoodsInputcode']} "
|
||||
f"到促销白名单失败")
|
||||
|
||||
|
||||
|
@ -24,7 +24,6 @@ class Test_CVip007(unittest.TestCase):
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.yms = YMServiceApi()
|
||||
# 重量放通白名单商品暂未提供
|
||||
self.vip_phone_num = VIPPhoneNumber
|
||||
self.weight_to_whitelist_goods = WeightToWhitelistGoods
|
||||
self.market_and_store_info = {
|
||||
@ -64,14 +63,14 @@ class Test_CVip007(unittest.TestCase):
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.weight_to_whitelist_goods["GoodsInputcode"]} 不存在")
|
||||
raise Exception(f"---商品 {self.weight_to_whitelist_goods["GoodsInputcode"]} 不存在")
|
||||
pytest.fail(f"---商品 {self.weight_to_whitelist_goods["GoodsInputcode"]} 不存在")
|
||||
|
||||
allure.step("[后置处理]:删除添加的重量放通白名单商品")
|
||||
self.yms.delete_weight_whitelist_goods()
|
||||
else:
|
||||
LOGGER.info(f"---添加商品 {self.weight_to_whitelist_goods['GoodsInputcode']} "
|
||||
f"到重量放通白名单失败")
|
||||
raise Exception(f"---添加商品 {self.weight_to_whitelist_goods['GoodsInputcode']} "
|
||||
pytest.fail(f"---添加商品 {self.weight_to_whitelist_goods['GoodsInputcode']} "
|
||||
f"到重量放通白名单失败")
|
||||
|
||||
|
||||
|
@ -22,8 +22,8 @@ class Test_CVip008(unittest.TestCase):
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.vip_phone_num = VIPPhoneNumber
|
||||
self.shoppingbag_mid = GoodsBagInputcode_mid # 乐事薯片
|
||||
self.shoppingbag_max = GoodsBagInputcode_max # 统一番茄牛肉面
|
||||
self.shoppingbag_mid = GoodsBagInputcode_mid
|
||||
self.shoppingbag_max = GoodsBagInputcode_max
|
||||
|
||||
def test_CVip008_ReturnShoppingBag(self):
|
||||
allure.dynamic.description(f"描述:{DescName}")
|
||||
@ -60,10 +60,10 @@ class Test_CVip008(unittest.TestCase):
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.shoppingbag_max} 不存在")
|
||||
raise AssertionError(f"---商品 {self.shoppingbag_max} 不存在")
|
||||
pytest.fail(f"---商品 {self.shoppingbag_max} 不存在")
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.shoppingbag_mid} 不存在")
|
||||
raise AssertionError(f"---商品 {self.shoppingbag_mid} 不存在")
|
||||
pytest.fail(f"---商品 {self.shoppingbag_mid} 不存在")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -22,8 +22,8 @@ class Test_CVip009(unittest.TestCase):
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.vip_phone_num = VIPPhoneNumber
|
||||
self.goods_01 = NormalGoodsInputcode01 # 乐事薯片
|
||||
self.goods_02 = NormalGoodsInputcode02 # 统一番茄牛肉面
|
||||
self.goods_01 = NormalGoodsInputcode01
|
||||
self.goods_02 = NormalGoodsInputcode02
|
||||
|
||||
def test_CVip009_ReturnPurchaseOfOrdinaryGoods(self):
|
||||
allure.dynamic.description(f"描述:{DescName}")
|
||||
@ -60,10 +60,10 @@ class Test_CVip009(unittest.TestCase):
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.goods_02} 不存在")
|
||||
raise AssertionError(f"---商品 {self.goods_02} 不存在")
|
||||
pytest.fail(f"---商品 {self.goods_02} 不存在")
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.goods_01} 不存在")
|
||||
raise AssertionError(f"---商品 {self.goods_01} 不存在")
|
||||
pytest.fail(f"---商品 {self.goods_01} 不存在")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -22,8 +22,8 @@ class Test_CVip010(unittest.TestCase):
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.vip_phone_num = VIPPhoneNumber
|
||||
self.vip_goods_01 = VipGoodsInputcode # 乐事薯片
|
||||
self.vip_goods_02 = VipGoodsInputcode02 # 统一番茄牛肉面
|
||||
self.vip_goods_01 = VipGoodsInputcode
|
||||
self.vip_goods_02 = VipGoodsInputcode02
|
||||
|
||||
def test_CVip010_ReturnOfMemberProducts(self):
|
||||
allure.dynamic.description(f"描述:{DescName}")
|
||||
@ -60,10 +60,10 @@ class Test_CVip010(unittest.TestCase):
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.vip_goods_02} 不存在")
|
||||
raise AssertionError(f"---商品 {self.vip_goods_02} 不存在")
|
||||
pytest.fail(f"---商品 {self.vip_goods_02} 不存在")
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.vip_goods_01} 不存在")
|
||||
raise AssertionError(f"---商品 {self.vip_goods_01} 不存在")
|
||||
pytest.fail(f"---商品 {self.vip_goods_01} 不存在")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -22,8 +22,8 @@ class Test_CVip011(unittest.TestCase):
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.vip_phone_num = VIPPhoneNumber
|
||||
self.goods_inputcode1 = NormalGoodsInputcode01 # 乐事薯片
|
||||
self.goods_inputcode2 = NormalGoodsInputcode02 # 统一番茄牛肉面
|
||||
self.goods_inputcode1 = NormalGoodsInputcode01
|
||||
self.goods_inputcode2 = NormalGoodsInputcode02
|
||||
|
||||
def test_CVip011_ReturnOneItemFromMultiplePurchases(self):
|
||||
allure.dynamic.description(f"描述:{DescName}")
|
||||
@ -60,10 +60,10 @@ class Test_CVip011(unittest.TestCase):
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.goods_inputcode2} 不存在")
|
||||
raise AssertionError(f"---商品 {self.goods_inputcode2} 不存在")
|
||||
pytest.fail(f"---商品 {self.goods_inputcode2} 不存在")
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.goods_inputcode1} 不存在")
|
||||
raise AssertionError(f"---商品 {self.goods_inputcode1} 不存在")
|
||||
pytest.fail(f"---商品 {self.goods_inputcode1} 不存在")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -22,7 +22,7 @@ class Test_CVip012(unittest.TestCase):
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.vip_phone_num = VIPPhoneNumber
|
||||
self.sale_goods_inputCode = SaleGoodsInputCode # 乐事薯片
|
||||
self.sale_goods_inputCode = SaleGoodsInputCode
|
||||
|
||||
def test_CVip012_ReturnOfDiscountedProducts(self):
|
||||
allure.dynamic.description(f"描述:{DescName}")
|
||||
@ -54,7 +54,7 @@ class Test_CVip012(unittest.TestCase):
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.sale_goods_inputCode} 不存在")
|
||||
raise AssertionError(f"---商品 {self.sale_goods_inputCode} 不存在")
|
||||
pytest.fail(f"---商品 {self.sale_goods_inputCode} 不存在")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -23,7 +23,6 @@ class Test_CVip013(unittest.TestCase):
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.yms = YMServiceApi()
|
||||
# 促销白名单商品暂未提供
|
||||
self.vip_phone_num = VIPPhoneNumber
|
||||
self.promotional_whitelist_goods = PromotionalWhitelistGoods
|
||||
self.market_and_store_info = {
|
||||
@ -73,16 +72,16 @@ class Test_CVip013(unittest.TestCase):
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.promotional_whitelist_goods["GoodsInputcode"]} 不存在")
|
||||
raise Exception(f"---商品 {self.promotional_whitelist_goods["GoodsInputcode"]} 不存在")
|
||||
|
||||
allure.step("[后置处理]:删除添加的促销白名单商品")
|
||||
self.yms.delete_whitelist_goods()
|
||||
pytest.fail(f"---商品 {self.promotional_whitelist_goods["GoodsInputcode"]} 不存在")
|
||||
else:
|
||||
LOGGER.info(f"---添加商品 {self.promotional_whitelist_goods['GoodsInputcode']} "
|
||||
f"到促销白名单失败")
|
||||
raise Exception(f"---添加商品 {self.promotional_whitelist_goods['GoodsInputcode']} "
|
||||
pytest.fail(f"---添加商品 {self.promotional_whitelist_goods['GoodsInputcode']} "
|
||||
f"到促销白名单失败")
|
||||
|
||||
def tearDown(self) -> None:
|
||||
allure.step("[后置处理]:删除添加的促销白名单商品")
|
||||
self.yms.delete_whitelist_goods()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2)
|
@ -23,7 +23,6 @@ class Test_CVip014(unittest.TestCase):
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.yms = YMServiceApi()
|
||||
# 重量放通白名单商品暂未提供
|
||||
self.vip_phone_num = VIPPhoneNumber
|
||||
self.weight_to_whitelist_goods = WeightToWhitelistGoods
|
||||
self.market_and_store_info = {
|
||||
@ -73,16 +72,16 @@ class Test_CVip014(unittest.TestCase):
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {self.weight_to_whitelist_goods["GoodsInputcode"]} 不存在")
|
||||
raise Exception(f"---商品 {self.weight_to_whitelist_goods['GoodsInputcode']} 不存在")
|
||||
|
||||
allure.step("[后置处理]:删除添加的重量放通白名单商品")
|
||||
self.yms.delete_weight_whitelist_goods()
|
||||
pytest.fail(f"---商品 {self.weight_to_whitelist_goods['GoodsInputcode']} 不存在")
|
||||
else:
|
||||
LOGGER.info(f"---添加商品 {self.weight_to_whitelist_goods['GoodsInputcode']} "
|
||||
f"到重量放通白名单失败")
|
||||
raise Exception(f"---添加商品 {self.weight_to_whitelist_goods['GoodsInputcode']} "
|
||||
f"到重量放通白名单失败")
|
||||
pytest.fail(f"---添加商品 {self.weight_to_whitelist_goods['GoodsInputcode']} "
|
||||
f"到重量放通白名单失败")
|
||||
|
||||
def tearDown(self) -> None:
|
||||
allure.step("[后置处理]:删除添加的重量放通白名单商品")
|
||||
self.yms.delete_weight_whitelist_goods()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2)
|
@ -0,0 +1,53 @@
|
||||
# !/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# @Author:: Arthur Wu
|
||||
# @Description:: 匿名转会员登录,加购计件商品,并结算
|
||||
# @Date:: 2024/11/22
|
||||
import unittest,allure,time,pytest
|
||||
from configs.globalObj import LOGGER
|
||||
from YiMao.businessFunc.ClientApiLib import YMClientApi
|
||||
from YiMao.data.WuShangSceneTestData import *
|
||||
|
||||
|
||||
DescName = "Vip015-匿名转会员登录,加购计件商品,并结算"
|
||||
@allure.story(f'[场景测试] {DescName}验证')
|
||||
class Test_CVip015(unittest.TestCase):
|
||||
f'''@Date:: 2024/11/22
|
||||
@Author:: Arthur Wu
|
||||
@Desc::
|
||||
[购物车客户端] {DescName}
|
||||
'''
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.vip_phone_num = VIPPhoneNumber
|
||||
self.piece_rate_goods = PieceRateGoods["GoodsInputcode"]
|
||||
|
||||
def test_CVip015(self):
|
||||
allure.dynamic.description(f"描述:{DescName}\n")
|
||||
allure.step("步骤1:session开始")
|
||||
self.ymc.session_start()
|
||||
allure.step("步骤2:匿名登录")
|
||||
Payload01 = {"action": 0, "isAnon": True}
|
||||
LoginData = self.ymc.login_app_v2(Payload01)
|
||||
|
||||
allure.step("步骤3:切换会员登录")
|
||||
Payload02 = {"action": 1, "code": self.vip_phone_num, "isAnon": False}
|
||||
self.ymc.login_app_v2(Payload02)
|
||||
|
||||
allure.step("步骤3:获取商品信息")
|
||||
GetGoodsInfoResp_01 = self.ymc.get_goods_info(self.piece_rate_goods)
|
||||
if GetGoodsInfoResp_01['msg'] != '加购商品不存在':
|
||||
allure.step("步骤4:添加会员有优惠商品")
|
||||
self.ymc.add_cart_goods(GetGoodsInfoResp_01, 1, LoginData)
|
||||
allure.step("步骤5:获取购物车商品信息")
|
||||
self.ymc.get_cart_goods_info([GetGoodsInfoResp_01])
|
||||
allure.step("步骤6:请求订单结算")
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {PieceRateGoods} 不存在")
|
||||
pytest.fail(f"---商品 {PieceRateGoods} 不存在")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2)
|
@ -0,0 +1,61 @@
|
||||
# !/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# @Author:: Arthur Wu
|
||||
# @Description:: 匿名转会员登录,加购计件商品,并退购
|
||||
# @Date:: 2024/11/22
|
||||
import unittest,allure,time,pytest
|
||||
from configs.globalObj import LOGGER
|
||||
from YiMao.businessFunc.ClientApiLib import YMClientApi
|
||||
from YiMao.data.WuShangSceneTestData import *
|
||||
|
||||
|
||||
DescName = "Vip016-匿名转会员登录,加购计件商品,并退购"
|
||||
@allure.story(f'[场景测试] {DescName}验证')
|
||||
class Test_CVip016(unittest.TestCase):
|
||||
f'''@Date:: 2024/11/22
|
||||
@Author:: Arthur Wu
|
||||
@Desc::
|
||||
[购物车客户端] {DescName}
|
||||
1、步骤
|
||||
1)加购计件或计重商品
|
||||
2)退购一件
|
||||
'''
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.vip_phone_num = VIPPhoneNumber
|
||||
self.piece_rate_goods = PieceRateGoods["GoodsInputcode"]
|
||||
|
||||
def test_CVip016(self):
|
||||
allure.dynamic.description(f"描述:{DescName}\n")
|
||||
allure.step("步骤1:session开始")
|
||||
self.ymc.session_start()
|
||||
allure.step("步骤2:匿名登录")
|
||||
Payload01 = {"action": 0, "isAnon": True}
|
||||
LoginData = self.ymc.login_app_v2(Payload01)
|
||||
|
||||
allure.step("步骤3:切换会员登录")
|
||||
Payload02 = {"action": 1, "code": self.vip_phone_num, "isAnon": False}
|
||||
self.ymc.login_app_v2(Payload02)
|
||||
|
||||
allure.step("步骤3:获取商品信息")
|
||||
GetGoodsInfoResp_01 = self.ymc.get_goods_info(self.piece_rate_goods)
|
||||
if GetGoodsInfoResp_01['msg'] != '加购商品不存在':
|
||||
allure.step("步骤4:添加会员有优惠商品")
|
||||
AddGoodsResp = self.ymc.add_cart_goods(GetGoodsInfoResp_01, 1, LoginData)
|
||||
|
||||
allure.step("\n步骤7:退购一件商品")
|
||||
GetGoodsInfoList = [GetGoodsInfoResp_01]
|
||||
self.ymc.delete_cart_goods(GetGoodsInfoList, LoginData, AddGoodsResp)
|
||||
|
||||
allure.step("步骤5:获取购物车商品信息")
|
||||
self.ymc.get_cart_goods_info([GetGoodsInfoResp_01])
|
||||
allure.step("步骤6:请求订单结算")
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {PieceRateGoods} 不存在")
|
||||
pytest.fail(f"---商品 {PieceRateGoods} 不存在")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2)
|
@ -0,0 +1,53 @@
|
||||
# !/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# @Author:: Arthur Wu
|
||||
# @Description:: 匿名转会员登录,加购计重商品,并结算
|
||||
# @Date:: 2024/11/22
|
||||
import unittest,allure,time,pytest
|
||||
from configs.globalObj import LOGGER
|
||||
from YiMao.businessFunc.ClientApiLib import YMClientApi
|
||||
from YiMao.data.WuShangSceneTestData import *
|
||||
|
||||
|
||||
DescName = "Vip017-匿名转会员登录,加购计重商品,并结算"
|
||||
@allure.story(f'[场景测试] {DescName}验证')
|
||||
class Test_CVip017(unittest.TestCase):
|
||||
f'''@Date:: 2024/11/22
|
||||
@Author:: Arthur Wu
|
||||
@Desc::
|
||||
[购物车客户端] {DescName}
|
||||
'''
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.vip_phone_num = VIPPhoneNumber
|
||||
self.bulk_goods = BulkGoods["GoodsInputcode"]
|
||||
|
||||
def test_CVip017(self):
|
||||
allure.dynamic.description(f"描述:{DescName}\n")
|
||||
allure.step("步骤1:session开始")
|
||||
self.ymc.session_start()
|
||||
allure.step("步骤2:匿名登录")
|
||||
Payload01 = {"action": 0, "isAnon": True}
|
||||
LoginData = self.ymc.login_app_v2(Payload01)
|
||||
|
||||
allure.step("步骤3:切换会员登录")
|
||||
Payload02 = {"action": 1, "code": self.vip_phone_num, "isAnon": False}
|
||||
self.ymc.login_app_v2(Payload02)
|
||||
|
||||
allure.step("步骤3:获取商品信息")
|
||||
GetGoodsInfoResp_01 = self.ymc.get_goods_info(self.bulk_goods)
|
||||
if GetGoodsInfoResp_01['msg'] != '加购商品不存在':
|
||||
allure.step("步骤4:添加会员有优惠商品")
|
||||
self.ymc.add_cart_goods(GetGoodsInfoResp_01, 1, LoginData)
|
||||
allure.step("步骤5:获取购物车商品信息")
|
||||
self.ymc.get_cart_goods_info([GetGoodsInfoResp_01])
|
||||
allure.step("步骤6:请求订单结算")
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {BulkGoods} 不存在")
|
||||
pytest.fail(f"---商品 {BulkGoods} 不存在")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2)
|
@ -0,0 +1,61 @@
|
||||
# !/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# @Author:: Arthur Wu
|
||||
# @Description:: 匿名转会员登录,加购计重商品,并退购
|
||||
# @Date:: 2024/11/22
|
||||
import unittest,allure,time,pytest
|
||||
from configs.globalObj import LOGGER
|
||||
from YiMao.businessFunc.ClientApiLib import YMClientApi
|
||||
from YiMao.data.WuShangSceneTestData import *
|
||||
|
||||
|
||||
DescName = "Vip018-匿名转会员登录,加购计重商品,并退购"
|
||||
@allure.story(f'[场景测试] {DescName}验证')
|
||||
class Test_CVip018(unittest.TestCase):
|
||||
f'''@Date:: 2024/11/22
|
||||
@Author:: Arthur Wu
|
||||
@Desc::
|
||||
[购物车客户端] {DescName}
|
||||
1、步骤
|
||||
1)加购计件或计重商品
|
||||
2)退购一件
|
||||
'''
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
self.ymc = YMClientApi(ShoppingCartMac)
|
||||
self.vip_phone_num = VIPPhoneNumber
|
||||
self.bulk_goods = BulkGoods["GoodsInputcode"]
|
||||
|
||||
def test_CVip018(self):
|
||||
allure.dynamic.description(f"描述:{DescName}\n")
|
||||
allure.step("步骤1:session开始")
|
||||
self.ymc.session_start()
|
||||
allure.step("步骤2:匿名登录")
|
||||
Payload01 = {"action": 0, "isAnon": True}
|
||||
LoginData = self.ymc.login_app_v2(Payload01)
|
||||
|
||||
allure.step("步骤3:切换会员登录")
|
||||
Payload02 = {"action": 1, "code": self.vip_phone_num, "isAnon": False}
|
||||
self.ymc.login_app_v2(Payload02)
|
||||
|
||||
allure.step("步骤3:获取商品信息")
|
||||
GetGoodsInfoResp_01 = self.ymc.get_goods_info(self.bulk_goods)
|
||||
if GetGoodsInfoResp_01['msg'] != '加购商品不存在':
|
||||
allure.step("步骤4:添加会员有优惠商品")
|
||||
AddGoodsResp = self.ymc.add_cart_goods(GetGoodsInfoResp_01, 1, LoginData)
|
||||
|
||||
allure.step("\n步骤5:退购一件商品")
|
||||
GetGoodsInfoList = [GetGoodsInfoResp_01]
|
||||
self.ymc.delete_cart_goods(GetGoodsInfoList, LoginData, AddGoodsResp)
|
||||
|
||||
allure.step("步骤6:获取购物车商品信息")
|
||||
self.ymc.get_cart_goods_info([GetGoodsInfoResp_01])
|
||||
allure.step("步骤7:请求订单结算")
|
||||
self.ymc.request_order_settlement(LoginData)
|
||||
else:
|
||||
LOGGER.info(f"---商品 {BulkGoods} 不存在")
|
||||
pytest.fail(f"---商品 {BulkGoods} 不存在")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2)
|
Reference in New Issue
Block a user