diff --git a/MAIN_YM.py b/MAIN_YM.py index a7b79cf..6bc08ce 100644 --- a/MAIN_YM.py +++ b/MAIN_YM.py @@ -1,9 +1,39 @@ # !/usr/bin/python # -*- coding: utf-8 -*- # This is a sample Python script. - # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. +import threading +import time + + +# # 要并发执行的任务函数 +# def task(thread_name, delay): +# print(f"Thread {thread_name} starting") +# time.sleep(delay) +# print(f"Thread {thread_name} finished") +# +# +# # 主程序 +# def main(): +# # 创建线程列表 +# threads = [] +# # 创建线程并启动 +# for i in range(3): +# t = threading.Thread(target=task, args=("Thread-{}".format(i), i)) +# threads.append(t) +# t.start() +# +# # 等待所有线程完成 +# for t in threads: +# t.join() +# +# +# if __name__ == "__main__": +# main() + + + def print_hi(name): from commons.EngineX import Engine, NotificationModule diff --git a/YiMao/ZeroLib/test_C020_NonToVipAddDiscountedProductsForPurchase.py b/YiMao/ZeroLib/test_C020_NonToVipAddDiscountedProductsForPurchase.py deleted file mode 100644 index af743ee..0000000 --- a/YiMao/ZeroLib/test_C020_NonToVipAddDiscountedProductsForPurchase.py +++ /dev/null @@ -1,5 +0,0 @@ -# !/usr/bin/python -# -*- coding: utf-8 -*- -# @Author:: Arthur Wu -# @Description:: 游客转会员登录,加购打折商品,并结算 -# @Date:: 2021-05-10 16:30:23 \ No newline at end of file diff --git a/YiMao/ZeroLib/test_C021_NonToVipAddPromotionalWhitelistProducts.py b/YiMao/ZeroLib/test_C021_NonToVipAddPromotionalWhitelistProducts.py deleted file mode 100644 index a594839..0000000 --- a/YiMao/ZeroLib/test_C021_NonToVipAddPromotionalWhitelistProducts.py +++ /dev/null @@ -1,5 +0,0 @@ -# !/usr/bin/python -# -*- coding: utf-8 -*- -# @Author:: Arthur Wu -# @Description:: 游客转会员登录,加购促销白名单商品,并结算 -# @Date:: 2021-05-10 16:30:22 \ No newline at end of file diff --git a/YiMao/ZeroLib/test_C022_NonToVipAddWeightToTheProduct.py b/YiMao/ZeroLib/test_C022_NonToVipAddWeightToTheProduct.py deleted file mode 100644 index 8b23613..0000000 --- a/YiMao/ZeroLib/test_C022_NonToVipAddWeightToTheProduct.py +++ /dev/null @@ -1,4 +0,0 @@ -# !/usr/bin/python -# -*- coding: utf-8 -*- -# @Author:: Arthur Wu -# @Description:: 游客转会员登录,加购重量放通商品,并结算 diff --git a/YiMao/ZeroLib/test_C023_NonToVipReturnShoppingBag.py b/YiMao/ZeroLib/test_C023_NonToVipReturnShoppingBag.py deleted file mode 100644 index d7dd3a1..0000000 --- a/YiMao/ZeroLib/test_C023_NonToVipReturnShoppingBag.py +++ /dev/null @@ -1,5 +0,0 @@ -# !/usr/bin/python -# -*- coding: utf-8 -*- -# @Author:: Arthur Wu -# @Description:: 游客转会员登录,加购2个购物袋,退购一个购物袋,并结算 -# @Date:: 2021-05-10 15:30:27 \ No newline at end of file diff --git a/YiMao/ZeroLib/test_C024_NonToVipReturnPurchaseOfOrdinaryGoods.py b/YiMao/ZeroLib/test_C024_NonToVipReturnPurchaseOfOrdinaryGoods.py deleted file mode 100644 index 991c74c..0000000 --- a/YiMao/ZeroLib/test_C024_NonToVipReturnPurchaseOfOrdinaryGoods.py +++ /dev/null @@ -1,5 +0,0 @@ -# !/usr/bin/python -# -*- coding: utf-8 -*- -# @Author:: Arthur Wu -# @Description:: 游客转会员登录,加购2个普通商品,退购一个,并结算 -# @Date:: 2021-05-10 15:30:27 \ No newline at end of file diff --git a/YiMao/ZeroLib/test_C025_NonToVipReturnOfMemberProducts.py b/YiMao/ZeroLib/test_C025_NonToVipReturnOfMemberProducts.py deleted file mode 100644 index 906b215..0000000 --- a/YiMao/ZeroLib/test_C025_NonToVipReturnOfMemberProducts.py +++ /dev/null @@ -1,5 +0,0 @@ -# !/usr/bin/python -# -*- coding: utf-8 -*- -# @Author:: Arthur Wu -# @Description:: 游客转会员登录,加购2个会员商品,退购一个,并结算 -# @Date:: 2021-05-10 15:30:27 \ No newline at end of file diff --git a/YiMao/ZeroLib/test_C026_NonToVipReturnOneItemFromMultiplePurchases.py b/YiMao/ZeroLib/test_C026_NonToVipReturnOneItemFromMultiplePurchases.py deleted file mode 100644 index 2eb1ab1..0000000 --- a/YiMao/ZeroLib/test_C026_NonToVipReturnOneItemFromMultiplePurchases.py +++ /dev/null @@ -1,4 +0,0 @@ -# !/usr/bin/python -# -*- coding: utf-8 -*- -# @Author:: Arthur Wu -# @Description:: 游客转会员登录,加购多件商品,退购一个商品,并结算 diff --git a/YiMao/ZeroLib/test_C027_NonToVipReturnOfDiscountedProducts.py b/YiMao/ZeroLib/test_C027_NonToVipReturnOfDiscountedProducts.py deleted file mode 100644 index 022df6a..0000000 --- a/YiMao/ZeroLib/test_C027_NonToVipReturnOfDiscountedProducts.py +++ /dev/null @@ -1,5 +0,0 @@ -# !/usr/bin/python -# -*- coding: utf-8 -*- -# @Author:: Arthur Wu -# @Description:: 游客转会员登录,加购2个打折商品,退购一个,并结算 -# @Date:: 2021-05-10 15:30:22 \ No newline at end of file diff --git a/YiMao/ZeroLib/test_C028_NonToVipReturnPromotionWhitelistProducts.py b/YiMao/ZeroLib/test_C028_NonToVipReturnPromotionWhitelistProducts.py deleted file mode 100644 index d32cd06..0000000 --- a/YiMao/ZeroLib/test_C028_NonToVipReturnPromotionWhitelistProducts.py +++ /dev/null @@ -1,5 +0,0 @@ -# !/usr/bin/python -# -*- coding: utf-8 -*- -# @Author:: Arthur Wu -# @Description:: 游客转会员登录,加购2个促销白名单商品,退购一个,并结算 -# @Date:: 2021-05-10 16:30:22 \ No newline at end of file diff --git a/YiMao/ZeroLib/test_C029_NonToVipReturnWeightOfTheProducte.py b/YiMao/ZeroLib/test_C029_NonToVipReturnWeightOfTheProducte.py deleted file mode 100644 index ff4fdb5..0000000 --- a/YiMao/ZeroLib/test_C029_NonToVipReturnWeightOfTheProducte.py +++ /dev/null @@ -1,5 +0,0 @@ -# !/usr/bin/python -# -*- coding: utf-8 -*- -# @Author:: Arthur Wu -# @Description:: 游客转会员登录,加购2个重量放通商品,退购一个,并结算 -# @Date:: 2021-05-10 15:30:23 \ No newline at end of file diff --git a/YiMao/ZeroLib/test_C030_NonToVipReceiveCoupon.py b/YiMao/ZeroLib/test_C030_NonToVipReceiveCoupon.py index a3566fc..2df47a5 100644 --- a/YiMao/ZeroLib/test_C030_NonToVipReceiveCoupon.py +++ b/YiMao/ZeroLib/test_C030_NonToVipReceiveCoupon.py @@ -2,3 +2,4 @@ # -*- coding: utf-8 -*- # @Author:: Arthur Wu # @Description:: 会员登录,领取优惠券 +# @Date:: 2024/11/21 diff --git a/YiMao/businessFunc/ClientApiLib.py b/YiMao/businessFunc/ClientApiLib.py index dd3c7df..2680be2 100644 --- a/YiMao/businessFunc/ClientApiLib.py +++ b/YiMao/businessFunc/ClientApiLib.py @@ -8,9 +8,9 @@ from commons.SignatureYM import SignatureYM2 class YMClientApi(object): - def __init__(self): + def __init__(self, ShoppingCartMac): self.Domain = "https://api.test.yimaogo.com/cart" - self.headerss = SignatureYM2(Mac="b8:2d:28:04:c7:5c")._headers() + self.headerss = SignatureYM2(ShoppingCartMac)._headers() ''' 1- without sessionid ''' def get_ads_list(self): @@ -99,8 +99,9 @@ class YMClientApi(object): "deleteGoods": [], "existGoods": [], "orderNo": LoginData["data"][0]["orderNo"] - }) + }, indent=4, ensure_ascii=False) url = self.Domain+"/v2/shopping/add/retire/purchase" + logging.info(f"---加购商品请求体payload: {payload}---") response = requests.request("POST", url, headers=self.headerss, data=payload) logging.info(f"-----------接口返回状态码:{response.status_code}") logging.info(f"-----------接口返回数据:{response.json()}\n\n") diff --git a/YiMao/data/WuShangSceneTestData.py b/YiMao/data/WuShangSceneTestData.py index 140693b..a1f4fb2 100644 --- a/YiMao/data/WuShangSceneTestData.py +++ b/YiMao/data/WuShangSceneTestData.py @@ -12,8 +12,10 @@ adsAreaId-5: 扫码广告 adsAreaId-6: 支付后广告 adsAreaId-7: 小票广告 ''' +''' 1-购物车Mac地址 ''' +ShoppingCartMac = "b8:2d:28:04:c7:5c" -'''1-武商会员账号''' +''' -武商会员账号 ''' VIPPhoneNumber = "17786408673" ''' -商超、门店信息 @@ -25,18 +27,25 @@ MarketAndStoreDetails = {"putMarketId": 50, "putStoreId": ["69"]} GoodsBagInputcode_mid = '6971648922990' GoodsBagInputcode_max = '6971648922983' ''' -普通商品-2件 ''' -NormalGoodsInputcode01 = "6924743915848" # 乐事薯片 +NormalGoodsInputcode01 = "6925791908202" # 荆味酥糖 NormalGoodsInputcode02 = "6925303796426" # 统一番茄牛肉面 -''' -会员商品 ''' -VipGoodsInputcode = "6925303796426" # 统一番茄牛肉面 -VipGoodsInputcode02 = "6924743915848" # 乐事薯片 -''' -折扣商品 ''' -SaleGoodsInputCode = "6924743915848" # 乐事薯片 -''' -促销商品白名单 ''' -PromotionalWhitelistGoods = {"GoodsInputcode": "6925303796426", "GoodsName": "统一茄皇蕃茄牛肉面"} -''' -重量放通白名单 ''' -WeightToWhitelistGoods = {"GoodsInputcode": "6924743915848", "GoodsName": "乐事无限翡翠黄瓜味薯片"} +NormalGoodsInputcode03 = "6924743915848" # 乐事薯片 +''' -优惠商品 ''' +VipGoodsInputcode = "6922024730036" # 大白兔奶糖 +VipGoodsInputcode02 = "4897114790479" # 维极熊白啤酒1L +VipGoodsInputcode03 = "4820193033335" # 巴瓦克纯麦啤酒 + +''' -折扣商品 ''' +SaleGoodsInputCode = "9588856298051" # 濠品轩燕麦酥 +''' -促销商品白名单 ''' +PromotionalWhitelistGoods = {"GoodsInputcode": "9588856298051", "GoodsName": "濠品轩燕麦酥"} +''' -重量放通白名单 ''' +WeightToWhitelistGoods = {"GoodsInputcode": "6922024730036", "GoodsName": "大白兔奶糖"} +''' -散称商品 ''' +BulkGoods = {"GoodsInputcode": "2934431009517", "GoodsName": "阿克苏苹果"} +''' -计件商品 ''' +PieceRateGoods = {"GoodsInputcode": "2910551005806", "GoodsName": "优选大白菜秧"} ''' 0-广告数据 ''' diff --git a/YiMao/data/前后端联测业务场景梳理.xlsx b/YiMao/data/前后端联测业务场景梳理.xlsx index eedaa74..4b93197 100644 Binary files a/YiMao/data/前后端联测业务场景梳理.xlsx and b/YiMao/data/前后端联测业务场景梳理.xlsx differ diff --git a/YiMao/scripts/BusiScenarios/test_C002_NonVipAddShoppingBagAndSettlePayment.py b/YiMao/scripts/BusiScenarios/test_CAnon001_AddShoppingBagAndSettlePayment.py similarity index 85% rename from YiMao/scripts/BusiScenarios/test_C002_NonVipAddShoppingBagAndSettlePayment.py rename to YiMao/scripts/BusiScenarios/test_CAnon001_AddShoppingBagAndSettlePayment.py index bc7f2f9..980c0c8 100644 --- a/YiMao/scripts/BusiScenarios/test_C002_NonVipAddShoppingBagAndSettlePayment.py +++ b/YiMao/scripts/BusiScenarios/test_CAnon001_AddShoppingBagAndSettlePayment.py @@ -9,9 +9,9 @@ from YiMao.businessFunc.ClientApiLib import YMClientApi from YiMao.data.WuShangSceneTestData import * -DescName = "002-非会员加购购物袋并试算" +DescName = "Anon001-非会员加购购物袋并试算" @allure.story(f'[场景测试] {DescName}验证') -class Test_C002_NonVipAddShoppingBagAndSettlePayment(unittest.TestCase): +class Test_CAnon001_AddShoppingBagAndSettlePayment(unittest.TestCase): f'''@Date:: 2024/11/15 @Author:: Arthur Wu @Desc:: @@ -21,11 +21,11 @@ class Test_C002_NonVipAddShoppingBagAndSettlePayment(unittest.TestCase): ''' def setUp(self) -> None: self.timestamp = int(time.time()) - self.ymc = YMClientApi() + self.ymc = YMClientApi(ShoppingCartMac) self.goodsbag_mid = GoodsBagInputcode_mid self.goodsbag_max = GoodsBagInputcode_max - def test_C00201_AddMidShoppingbagsForPurchase(self): + def test_CAnon00101_AddMidShoppingbagsForPurchase(self): allure.dynamic.description(f"描述:加购中号购物袋") allure.step("步骤1:session开始") self.ymc.session_start() @@ -43,8 +43,9 @@ class Test_C002_NonVipAddShoppingBagAndSettlePayment(unittest.TestCase): self.ymc.request_order_settlement(LoginData) else: LOGGER.info(f"---购物袋 {self.goodsbag_mid} 不存在") + raise AssertionError(f"购物袋 {self.goodsbag_mid} 不存在") - def test_C00202_AddMaxShoppingbagsForPurchase(self): + def test_CAnon00102_AddMaxShoppingbagsForPurchase(self): allure.dynamic.description("描述:加购大号购物袋") allure.step("步骤1:session开始") self.ymc.session_start() @@ -62,6 +63,7 @@ class Test_C002_NonVipAddShoppingBagAndSettlePayment(unittest.TestCase): self.ymc.request_order_settlement(LoginData) else: LOGGER.info(f"---购物袋 {self.goodsbag_max} 不存在") + raise AssertionError(f"购物袋 {self.goodsbag_mid} 不存在") if __name__ == '__main__': diff --git a/YiMao/scripts/BusiScenarios/test_C003_NonVipAddNonDiscountedProductsForPurchase.py b/YiMao/scripts/BusiScenarios/test_CAnon002_AddNonDiscountedProductsForPurchase.py similarity index 85% rename from YiMao/scripts/BusiScenarios/test_C003_NonVipAddNonDiscountedProductsForPurchase.py rename to YiMao/scripts/BusiScenarios/test_CAnon002_AddNonDiscountedProductsForPurchase.py index 4303cfb..3b83d8b 100644 --- a/YiMao/scripts/BusiScenarios/test_C003_NonVipAddNonDiscountedProductsForPurchase.py +++ b/YiMao/scripts/BusiScenarios/test_CAnon002_AddNonDiscountedProductsForPurchase.py @@ -9,9 +9,9 @@ from YiMao.businessFunc.ClientApiLib import YMClientApi from YiMao.data.WuShangSceneTestData import * -DescName = "003-非会员加购无优惠商品并试算" +DescName = "Anon002-非会员加购无优惠商品并试算" @allure.story(f'[场景测试] {DescName}验证') -class Test_C003(unittest.TestCase): +class Test_CAnon002(unittest.TestCase): f'''@Date:: 2024/11/15 @Author:: Arthur Wu @Desc:: test_C003_NonVipAddNonDiscountedProductsForPurchase @@ -21,10 +21,10 @@ class Test_C003(unittest.TestCase): ''' def setUp(self) -> None: self.timestamp = int(time.time()) - self.ymc = YMClientApi() + self.ymc = YMClientApi(ShoppingCartMac) self.NormalGoodsInputcode01 = NormalGoodsInputcode01 # 乐事薯片 - def test_C003_NonVipAddNonDiscountedProductsForPurchase(self): + def test_CAnon002_AddNonDiscountedProductsForPurchase(self): allure.dynamic.description(f"描述:{DescName}") allure.step("步骤1:session开始") self.ymc.session_start() @@ -42,6 +42,7 @@ class Test_C003(unittest.TestCase): self.ymc.request_order_settlement(LoginData) else: LOGGER.info(f"---商品 {self.NormalGoodsInputcode01} 不存在") + raise AssertionError(f"商品 {self.NormalGoodsInputcode01} 不存在") if __name__ == '__main__': diff --git a/YiMao/scripts/BusiScenarios/test_C004_NonVipAddMemberPproductsForPurchase.py b/YiMao/scripts/BusiScenarios/test_CAnon003_AddMemberProductsForPurchase.py similarity index 86% rename from YiMao/scripts/BusiScenarios/test_C004_NonVipAddMemberPproductsForPurchase.py rename to YiMao/scripts/BusiScenarios/test_CAnon003_AddMemberProductsForPurchase.py index f3aa5a2..a7f2a5c 100644 --- a/YiMao/scripts/BusiScenarios/test_C004_NonVipAddMemberPproductsForPurchase.py +++ b/YiMao/scripts/BusiScenarios/test_CAnon003_AddMemberProductsForPurchase.py @@ -9,9 +9,9 @@ from YiMao.businessFunc.ClientApiLib import YMClientApi from YiMao.data.WuShangSceneTestData import * -DescName = "004-非会员加购会员商品并结算" +DescName = "Anon003-非会员加购会员商品并结算" @allure.story(f'[场景测试] {DescName}验证') -class Test_C004(unittest.TestCase): +class Test_CAnon003(unittest.TestCase): f'''@Date:: 2024/11/15 @Author:: Arthur Wu @Desc:: @@ -21,11 +21,11 @@ class Test_C004(unittest.TestCase): ''' def setUp(self) -> None: self.timestamp = int(time.time()) - self.ymc = YMClientApi() + self.ymc = YMClientApi(ShoppingCartMac) # 会员有优惠商品暂未提供 self.vip_goods_inputcode = VipGoodsInputcode # 统一番茄牛肉面 - def test_C004_NonVipAddMemberPproductsForPurchase(self): + def test_CAnon003_AddMemberProductsForPurchase(self): allure.dynamic.description(f"描述:{DescName}") allure.step("步骤1:session开始") self.ymc.session_start() @@ -43,6 +43,7 @@ class Test_C004(unittest.TestCase): self.ymc.request_order_settlement(LoginData) else: LOGGER.info(f"---商品 {self.vip_goods_inputcode} 不存在") + raise AssertionError(f"商品 {self.vip_goods_inputcode} 不存在") if __name__ == '__main__': diff --git a/YiMao/scripts/BusiScenarios/test_C005_NonVipAddMultipleItemsForPurchase.py b/YiMao/scripts/BusiScenarios/test_CAnon004_AddMultipleItemsForPurchase.py similarity index 85% rename from YiMao/scripts/BusiScenarios/test_C005_NonVipAddMultipleItemsForPurchase.py rename to YiMao/scripts/BusiScenarios/test_CAnon004_AddMultipleItemsForPurchase.py index 5ae9e6e..b9ec95b 100644 --- a/YiMao/scripts/BusiScenarios/test_C005_NonVipAddMultipleItemsForPurchase.py +++ b/YiMao/scripts/BusiScenarios/test_CAnon004_AddMultipleItemsForPurchase.py @@ -9,9 +9,9 @@ from YiMao.businessFunc.ClientApiLib import YMClientApi from YiMao.data.WuShangSceneTestData import * -DescName = "005-非会员加购多件商品并结算" +DescName = "Anon004-非会员加购多件商品并结算" @allure.story(f'[场景测试] {DescName}验证') -class Test_C005(unittest.TestCase): +class Test_CAnon004(unittest.TestCase): f'''@Date:: 2024/11/15 @Author:: Arthur Wu @Desc:: @@ -20,11 +20,11 @@ class Test_C005(unittest.TestCase): ''' def setUp(self) -> None: self.timestamp = int(time.time()) - self.ymc = YMClientApi() + self.ymc = YMClientApi(ShoppingCartMac) self.goods_inputcode1 = NormalGoodsInputcode01 # 乐事薯片 self.goods_inputcode2 = NormalGoodsInputcode02 # 统一番茄牛肉面 - def test_C005_NonVipAddMultipleItemsForPurchase(self): + def test_CAnon004_AddMultipleItemsForPurchase(self): allure.dynamic.description(f"描述:{DescName}") allure.step("步骤1:session开始") self.ymc.session_start() @@ -47,8 +47,10 @@ class Test_C005(unittest.TestCase): self.ymc.request_order_settlement(LoginData) else: LOGGER.info(f"---商品 {self.goods_inputcode2} 不存在") + raise AssertionError(f"商品 {self.goods_inputcode2} 不存在") else: LOGGER.info(f"---商品 {self.goods_inputcode1} 不存在") + raise AssertionError(f"商品 {self.goods_inputcode1} 不存在") if __name__ == '__main__': diff --git a/YiMao/scripts/BusiScenarios/test_C006_NonVipAddDiscountedProductsForPurchase.py b/YiMao/scripts/BusiScenarios/test_CAnon005_AddDiscountedProductsForPurchase.py similarity index 85% rename from YiMao/scripts/BusiScenarios/test_C006_NonVipAddDiscountedProductsForPurchase.py rename to YiMao/scripts/BusiScenarios/test_CAnon005_AddDiscountedProductsForPurchase.py index 111271a..cbbcb52 100644 --- a/YiMao/scripts/BusiScenarios/test_C006_NonVipAddDiscountedProductsForPurchase.py +++ b/YiMao/scripts/BusiScenarios/test_CAnon005_AddDiscountedProductsForPurchase.py @@ -9,9 +9,9 @@ from YiMao.businessFunc.ClientApiLib import YMClientApi from YiMao.data.WuShangSceneTestData import * -DescName = "006-非会员加购打折商品并结算" +DescName = "Anon005-非会员加购打折商品并结算" @allure.story(f'[场景测试] {DescName}验证') -class Test_C006(unittest.TestCase): +class Test_CAnon005(unittest.TestCase): f'''@Date:: 2024/11/15 @Author:: Arthur Wu @Desc:: @@ -21,11 +21,11 @@ class Test_C006(unittest.TestCase): ''' def setUp(self) -> None: self.timestamp = int(time.time()) - self.ymc = YMClientApi() + self.ymc = YMClientApi(ShoppingCartMac) # 折扣商品暂未提供 self.sale_goods_inputCode = SaleGoodsInputCode # 乐事薯片 - def test_C006_NonVipAddDiscountedProductsForPurchase(self): + def test_CAnon005_AddDiscountedProductsForPurchase(self): allure.dynamic.description(f"描述:{DescName}") allure.step("步骤1:session开始") self.ymc.session_start() @@ -43,6 +43,7 @@ class Test_C006(unittest.TestCase): self.ymc.request_order_settlement(LoginData) else: LOGGER.info(f"---商品 {self.sale_goods_inputCode} 不存在") + raise Exception(f"---商品 {self.sale_goods_inputCode} 不存在") if __name__ == '__main__': diff --git a/YiMao/scripts/BusiScenarios/test_C007_NonVipAddPromotionalWhitelistProducts.py b/YiMao/scripts/BusiScenarios/test_CAnon006_AddPromotionalWhitelistProducts.py similarity index 86% rename from YiMao/scripts/BusiScenarios/test_C007_NonVipAddPromotionalWhitelistProducts.py rename to YiMao/scripts/BusiScenarios/test_CAnon006_AddPromotionalWhitelistProducts.py index 1159774..9381740 100644 --- a/YiMao/scripts/BusiScenarios/test_C007_NonVipAddPromotionalWhitelistProducts.py +++ b/YiMao/scripts/BusiScenarios/test_CAnon006_AddPromotionalWhitelistProducts.py @@ -10,9 +10,9 @@ from YiMao.businessFunc.ServiceApiLib import YMServiceApi from YiMao.data.WuShangSceneTestData import * -DescName = "007-非会员加购促销白名单商品并结算" +DescName = "Anon006-非会员加购促销白名单商品并结算" @allure.story(f'[场景测试] {DescName}验证') -class Test_C007(unittest.TestCase): +class Test_CAnon006(unittest.TestCase): f'''@Date:: 2024/11/15 @Author:: Arthur Wu @Desc:: @@ -22,7 +22,7 @@ class Test_C007(unittest.TestCase): ''' def setUp(self) -> None: self.timestamp = int(time.time()) - self.ymc = YMClientApi() + self.ymc = YMClientApi(ShoppingCartMac) self.yms = YMServiceApi() # 促销白名单商品暂未提供 self.promotional_whitelist_goods = PromotionalWhitelistGoods @@ -31,7 +31,7 @@ class Test_C007(unittest.TestCase): "StoreId": MarketAndStoreDetails["putStoreId"][0] } - def test_C007_NonVipAddPromotionalWhitelistProducts(self): + def test_CAnon006_AddPromotionalWhitelistProducts(self): allure.dynamic.description(f"描述:{DescName}") allure.step("[前置条件]:先调用管理平台接口,将指定商品添加到促销白名单中") pre_respomse = self.yms.add_promotional_product_whitelist( @@ -57,12 +57,15 @@ class Test_C007(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() else: LOGGER.info(f"---添加商品 {self.promotional_whitelist_goods['GoodsInputcode']} " f"到促销白名单失败") + raise Exception(f"---添加商品 {self.promotional_whitelist_goods['GoodsInputcode']} " + f"到促销白名单失败") if __name__ == '__main__': diff --git a/YiMao/scripts/BusiScenarios/test_C008_NonVipAddWeightToTheProduct.py b/YiMao/scripts/BusiScenarios/test_CAnon007_AddWeightToTheProduct.py similarity index 86% rename from YiMao/scripts/BusiScenarios/test_C008_NonVipAddWeightToTheProduct.py rename to YiMao/scripts/BusiScenarios/test_CAnon007_AddWeightToTheProduct.py index 308b268..f3800c5 100644 --- a/YiMao/scripts/BusiScenarios/test_C008_NonVipAddWeightToTheProduct.py +++ b/YiMao/scripts/BusiScenarios/test_CAnon007_AddWeightToTheProduct.py @@ -10,9 +10,9 @@ from YiMao.businessFunc.ServiceApiLib import YMServiceApi from YiMao.data.WuShangSceneTestData import * -DescName = "008-非会员加购重量放通商品并结算" +DescName = "Anon007-非会员加购重量放通商品并结算" @allure.story(f'[场景测试] {DescName}验证') -class Test_C008(unittest.TestCase): +class Test_CAnon007(unittest.TestCase): f'''@Date:: 2024/11/15 @Author:: Arthur Wu @Desc:: @@ -22,7 +22,7 @@ class Test_C008(unittest.TestCase): ''' def setUp(self) -> None: self.timestamp = int(time.time()) - self.ymc = YMClientApi() + self.ymc = YMClientApi(ShoppingCartMac) self.yms = YMServiceApi() # 重量放通白名单商品暂未提供 self.weight_to_whitelist_goods = WeightToWhitelistGoods @@ -31,7 +31,7 @@ class Test_C008(unittest.TestCase): "StoreId": MarketAndStoreDetails["putStoreId"][0] } - def test_C008_NonVipAddWeightToTheProduct(self): + def test_CAnon007_AddWeightToTheProduct(self): allure.dynamic.description(f"描述:{DescName}") allure.step("[前置条件]:先调用管理平台接口,将指定商品添加到重量放通白名单中") pre_respomse = self.yms.add_weight_to_whitelist( @@ -58,12 +58,15 @@ class Test_C008(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() else: LOGGER.info(f"---添加商品 {self.weight_to_whitelist_goods['GoodsInputcode']} " f"到重量放通白名单失败") + raise Exception(f"---添加商品 {self.weight_to_whitelist_goods['GoodsInputcode']} " + f"到重量放通白名单失败") if __name__ == '__main__': diff --git a/YiMao/scripts/BusiScenarios/test_C009_NonVipReturnShoppingBag.py b/YiMao/scripts/BusiScenarios/test_CAnon008_ReturnShoppingBag.py similarity index 87% rename from YiMao/scripts/BusiScenarios/test_C009_NonVipReturnShoppingBag.py rename to YiMao/scripts/BusiScenarios/test_CAnon008_ReturnShoppingBag.py index 34e750d..fa5223e 100644 --- a/YiMao/scripts/BusiScenarios/test_C009_NonVipReturnShoppingBag.py +++ b/YiMao/scripts/BusiScenarios/test_CAnon008_ReturnShoppingBag.py @@ -8,9 +8,10 @@ from configs.globalObj import LOGGER from YiMao.businessFunc.ClientApiLib import YMClientApi from YiMao.data.WuShangSceneTestData import * -DescName = "009-非会员,加购2个购物袋,退购一个购物袋,并结算" + +DescName = "Anon008-非会员,加购2个购物袋,退购一个购物袋,并结算" @allure.story(f'[场景测试] {DescName}验证') -class Test_C009(unittest.TestCase): +class Test_CAnon008(unittest.TestCase): f'''@Date:: 2024/11/20 @Author:: Arthur Wu @Desc:: @@ -19,11 +20,11 @@ class Test_C009(unittest.TestCase): ''' def setUp(self) -> None: self.timestamp = int(time.time()) - self.ymc = YMClientApi() + self.ymc = YMClientApi(ShoppingCartMac) self.shoppingbag_mid = GoodsBagInputcode_mid # 乐事薯片 self.shoppingbag_max = GoodsBagInputcode_max # 统一番茄牛肉面 - def test_C009_NonVipReturnShoppingBag(self): + def test_CAnon008_ReturnShoppingBag(self): allure.dynamic.description(f"描述:{DescName}") allure.step("步骤1:session开始") self.ymc.session_start() @@ -53,8 +54,10 @@ class Test_C009(unittest.TestCase): self.ymc.request_order_settlement(LoginData) else: LOGGER.info(f"---商品 {self.shoppingbag_max} 不存在") + raise AssertionError(f"---商品 {self.shoppingbag_max} 不存在") else: LOGGER.info(f"---商品 {self.shoppingbag_mid} 不存在") + raise AssertionError(f"---商品 {self.shoppingbag_mid} 不存在") if __name__ == '__main__': diff --git a/YiMao/scripts/BusiScenarios/test_C010_NonVipReturnPurchaseOfOrdinaryGoods.py b/YiMao/scripts/BusiScenarios/test_CAnon009_ReturnPurchaseOfOrdinaryGoods.py similarity index 87% rename from YiMao/scripts/BusiScenarios/test_C010_NonVipReturnPurchaseOfOrdinaryGoods.py rename to YiMao/scripts/BusiScenarios/test_CAnon009_ReturnPurchaseOfOrdinaryGoods.py index a9c665d..ee5c5e0 100644 --- a/YiMao/scripts/BusiScenarios/test_C010_NonVipReturnPurchaseOfOrdinaryGoods.py +++ b/YiMao/scripts/BusiScenarios/test_CAnon009_ReturnPurchaseOfOrdinaryGoods.py @@ -8,9 +8,10 @@ from configs.globalObj import LOGGER from YiMao.businessFunc.ClientApiLib import YMClientApi from YiMao.data.WuShangSceneTestData import * -DescName = "010-非会员,加购2个普通商品,退购一个,并结算" + +DescName = "Anon009-非会员,加购2个普通商品,退购一个,并结算" @allure.story(f'[场景测试] {DescName}验证') -class Test_C010(unittest.TestCase): +class Test_CAnon009(unittest.TestCase): f'''@Date:: 2024/11/20 @Author:: Arthur Wu @Desc:: @@ -19,11 +20,11 @@ class Test_C010(unittest.TestCase): ''' def setUp(self) -> None: self.timestamp = int(time.time()) - self.ymc = YMClientApi() + self.ymc = YMClientApi(ShoppingCartMac) self.goods_01 = NormalGoodsInputcode01 # 乐事薯片 self.goods_02 = NormalGoodsInputcode02 # 统一番茄牛肉面 - def test_C010_NonVipReturnPurchaseOfOrdinaryGoods(self): + def test_CAnon009_ReturnPurchaseOfOrdinaryGoods(self): allure.dynamic.description(f"描述:{DescName}") allure.step("步骤1:session开始") self.ymc.session_start() @@ -53,8 +54,10 @@ class Test_C010(unittest.TestCase): self.ymc.request_order_settlement(LoginData) else: LOGGER.info(f"---商品 {self.goods_02} 不存在") + raise AssertionError(f"---商品 {self.goods_02} 不存在") else: LOGGER.info(f"---商品 {self.goods_01} 不存在") + raise AssertionError(f"---商品 {self.goods_01} 不存在") if __name__ == '__main__': diff --git a/YiMao/scripts/BusiScenarios/test_C011_NonVipReturnOfMemberProducts.py b/YiMao/scripts/BusiScenarios/test_CAnon010_ReturnOfMemberProducts.py similarity index 87% rename from YiMao/scripts/BusiScenarios/test_C011_NonVipReturnOfMemberProducts.py rename to YiMao/scripts/BusiScenarios/test_CAnon010_ReturnOfMemberProducts.py index 4de23f7..beddf05 100644 --- a/YiMao/scripts/BusiScenarios/test_C011_NonVipReturnOfMemberProducts.py +++ b/YiMao/scripts/BusiScenarios/test_CAnon010_ReturnOfMemberProducts.py @@ -8,9 +8,10 @@ from configs.globalObj import LOGGER from YiMao.businessFunc.ClientApiLib import YMClientApi from YiMao.data.WuShangSceneTestData import * -DescName = "011-非会员,加购2个会员商品,退购一个,并结算" + +DescName = "Anon010-非会员,加购2个会员商品,退购一个,并结算" @allure.story(f'[场景测试] {DescName}验证') -class Test_C011(unittest.TestCase): +class Test_CAnon010(unittest.TestCase): f'''@Date:: 2024/11/20 @Author:: Arthur Wu @Desc:: @@ -19,11 +20,11 @@ class Test_C011(unittest.TestCase): ''' def setUp(self) -> None: self.timestamp = int(time.time()) - self.ymc = YMClientApi() + self.ymc = YMClientApi(ShoppingCartMac) self.vip_goods_01 = VipGoodsInputcode # 乐事薯片 self.vip_goods_02 = VipGoodsInputcode02 # 统一番茄牛肉面 - def test_C011_NonVipReturnOfMemberProducts(self): + def test_CAnon010_ReturnOfMemberProducts(self): allure.dynamic.description(f"描述:{DescName}") allure.step("步骤1:session开始") self.ymc.session_start() @@ -53,8 +54,10 @@ class Test_C011(unittest.TestCase): self.ymc.request_order_settlement(LoginData) else: LOGGER.info(f"---商品 {self.vip_goods_02} 不存在") + raise AssertionError(f"---商品 {self.vip_goods_02} 不存在") else: LOGGER.info(f"---商品 {self.vip_goods_01} 不存在") + raise AssertionError(f"---商品 {self.vip_goods_01} 不存在") if __name__ == '__main__': diff --git a/YiMao/scripts/BusiScenarios/test_C012_NonVipReturnOneItemFromMultiplePurchases.py b/YiMao/scripts/BusiScenarios/test_CAnon011_ReturnOneItemFromMultiplePurchases.py similarity index 86% rename from YiMao/scripts/BusiScenarios/test_C012_NonVipReturnOneItemFromMultiplePurchases.py rename to YiMao/scripts/BusiScenarios/test_CAnon011_ReturnOneItemFromMultiplePurchases.py index 630e08f..868cb89 100644 --- a/YiMao/scripts/BusiScenarios/test_C012_NonVipReturnOneItemFromMultiplePurchases.py +++ b/YiMao/scripts/BusiScenarios/test_CAnon011_ReturnOneItemFromMultiplePurchases.py @@ -8,9 +8,10 @@ from configs.globalObj import LOGGER from YiMao.businessFunc.ClientApiLib import YMClientApi from YiMao.data.WuShangSceneTestData import * -DescName = "012-非会员,加购多件商品,退购一个商品,并结算" + +DescName = "Anon011-非会员,加购多件商品,退购一个商品,并结算" @allure.story(f'[场景测试] {DescName}验证') -class Test_C012(unittest.TestCase): +class Test_CAnon011(unittest.TestCase): f'''@Date:: 2024/11/20 @Author:: Arthur Wu @Desc:: @@ -19,11 +20,11 @@ class Test_C012(unittest.TestCase): ''' def setUp(self) -> None: self.timestamp = int(time.time()) - self.ymc = YMClientApi() + self.ymc = YMClientApi(ShoppingCartMac) self.goods_inputcode1 = NormalGoodsInputcode01 # 乐事薯片 self.goods_inputcode2 = NormalGoodsInputcode02 # 统一番茄牛肉面 - def test_C012_NonVipReturnOneItemFromMultiplePurchases(self): + def test_CAnon011_ReturnOneItemFromMultiplePurchases(self): allure.dynamic.description(f"描述:{DescName}") allure.step("步骤1:session开始") self.ymc.session_start() @@ -53,8 +54,10 @@ class Test_C012(unittest.TestCase): self.ymc.request_order_settlement(LoginData) else: LOGGER.info(f"---商品 {self.goods_inputcode2} 不存在") + raise AssertionError(f"---商品 {self.goods_inputcode2} 不存在") else: LOGGER.info(f"---商品 {self.goods_inputcode1} 不存在") + raise AssertionError(f"---商品 {self.goods_inputcode1} 不存在") if __name__ == '__main__': diff --git a/YiMao/scripts/BusiScenarios/test_C013_NonVipReturnOfDiscountedProducts.py b/YiMao/scripts/BusiScenarios/test_CAnon012_ReturnOfDiscountedProducts.py similarity index 86% rename from YiMao/scripts/BusiScenarios/test_C013_NonVipReturnOfDiscountedProducts.py rename to YiMao/scripts/BusiScenarios/test_CAnon012_ReturnOfDiscountedProducts.py index 5db55c3..f38f80f 100644 --- a/YiMao/scripts/BusiScenarios/test_C013_NonVipReturnOfDiscountedProducts.py +++ b/YiMao/scripts/BusiScenarios/test_CAnon012_ReturnOfDiscountedProducts.py @@ -8,9 +8,10 @@ from configs.globalObj import LOGGER from YiMao.businessFunc.ClientApiLib import YMClientApi from YiMao.data.WuShangSceneTestData import * -DescName = "013-非会员,加购2个打折商品,退购一个,并结算" + +DescName = "Anon012-非会员,加购2个打折商品,退购一个,并结算" @allure.story(f'[场景测试] {DescName}验证') -class Test_C013(unittest.TestCase): +class Test_CAnon012(unittest.TestCase): f'''@Date:: 2024/11/20 @Author:: Arthur Wu @Desc:: @@ -19,10 +20,10 @@ class Test_C013(unittest.TestCase): ''' def setUp(self) -> None: self.timestamp = int(time.time()) - self.ymc = YMClientApi() + self.ymc = YMClientApi(ShoppingCartMac) self.sale_goods_inputCode = SaleGoodsInputCode # 乐事薯片 - def test_C013_NonVipReturnOfDiscountedProducts(self): + def test_CAnon012_ReturnOfDiscountedProducts(self): allure.dynamic.description(f"描述:{DescName}") allure.step("步骤1:session开始") self.ymc.session_start() @@ -47,6 +48,7 @@ class Test_C013(unittest.TestCase): self.ymc.request_order_settlement(LoginData) else: LOGGER.info(f"---商品 {self.sale_goods_inputCode} 不存在") + raise AssertionError(f"---商品 {self.sale_goods_inputCode} 不存在") if __name__ == '__main__': diff --git a/YiMao/scripts/BusiScenarios/test_C014_NonVipReturnPromotionWhitelistProducts.py b/YiMao/scripts/BusiScenarios/test_CAnon013_ReturnPromotionWhitelistProducts.py similarity index 81% rename from YiMao/scripts/BusiScenarios/test_C014_NonVipReturnPromotionWhitelistProducts.py rename to YiMao/scripts/BusiScenarios/test_CAnon013_ReturnPromotionWhitelistProducts.py index 4d21a9a..e0bd583 100644 --- a/YiMao/scripts/BusiScenarios/test_C014_NonVipReturnPromotionWhitelistProducts.py +++ b/YiMao/scripts/BusiScenarios/test_CAnon013_ReturnPromotionWhitelistProducts.py @@ -10,9 +10,9 @@ from YiMao.businessFunc.ServiceApiLib import YMServiceApi from YiMao.data.WuShangSceneTestData import * -DescName = "014-非会员加购2个促销白名单商品,退购一个" +DescName = "Anon013-非会员加购2个促销白名单商品,退购一个" @allure.story(f'[场景测试] {DescName}验证') -class Test_C014(unittest.TestCase): +class Test_CAnon013(unittest.TestCase): f'''@Date:: 2024/11/20 @Author:: Arthur Wu @Desc:: @@ -21,7 +21,7 @@ class Test_C014(unittest.TestCase): ''' def setUp(self) -> None: self.timestamp = int(time.time()) - self.ymc = YMClientApi() + self.ymc = YMClientApi(ShoppingCartMac) self.yms = YMServiceApi() # 促销白名单商品暂未提供 self.promotional_whitelist_goods = PromotionalWhitelistGoods @@ -30,7 +30,7 @@ class Test_C014(unittest.TestCase): "StoreId": MarketAndStoreDetails["putStoreId"][0] } - def test_C014_NonVipReturnPromotionWhitelistProducts(self): + def test_CAnon013_ReturnPromotionWhitelistProducts(self): allure.dynamic.description(f"描述:{DescName}") allure.step("[前置条件]:先调用管理平台接口,将指定商品添加到促销白名单中") pre_respomse = self.yms.add_promotional_product_whitelist( @@ -49,9 +49,13 @@ class Test_C014(unittest.TestCase): '''step1:加购商品x,分别加购x件''' allure.step("步骤3:获取促销白名单商品信息") GoodsInfoData1 = self.ymc.get_goods_info(self.promotional_whitelist_goods["GoodsInputcode"]) + LOGGER.info(f"---获取的商品信息为:{GoodsInfoData1}") + if GoodsInfoData1['data']['weight'] == 0: + GoodsInfoData1['data']['weight'] = 300 if GoodsInfoData1['msg'] != '加购商品不存在': allure.step("步骤4:加购白名单商品") - AddGoodsResp = self.ymc.add_cart_goods(GoodsInfoData1, 2, LoginData) + AddGoodsResp = self.ymc.add_cart_goods(GoodsInfoData1, 1, LoginData) + LOGGER.info(f"---加购商品返回结果:{AddGoodsResp}") ''' step2:随机退购一个商品,并结算 ''' allure.step("\n步骤5:退购一件商品") @@ -64,12 +68,15 @@ class Test_C014(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() else: LOGGER.info(f"---添加商品 {self.promotional_whitelist_goods['GoodsInputcode']} " f"到促销白名单失败") + raise Exception(f"---添加商品 {self.promotional_whitelist_goods['GoodsInputcode']} " + f"到促销白名单失败") if __name__ == '__main__': diff --git a/YiMao/scripts/BusiScenarios/test_C015_NonVipReturnWeightOfTheProducte.py b/YiMao/scripts/BusiScenarios/test_CAnon014_ReturnWeightOfTheProducte.py similarity index 81% rename from YiMao/scripts/BusiScenarios/test_C015_NonVipReturnWeightOfTheProducte.py rename to YiMao/scripts/BusiScenarios/test_CAnon014_ReturnWeightOfTheProducte.py index 1a15252..16b97a1 100644 --- a/YiMao/scripts/BusiScenarios/test_C015_NonVipReturnWeightOfTheProducte.py +++ b/YiMao/scripts/BusiScenarios/test_CAnon014_ReturnWeightOfTheProducte.py @@ -10,9 +10,9 @@ from YiMao.businessFunc.ServiceApiLib import YMServiceApi from YiMao.data.WuShangSceneTestData import * -DescName = "015-非会员加购2个重量放通商品,退购一个" +DescName = "Anon014-非会员加购2个重量放通商品,退购一个" @allure.story(f'[场景测试] {DescName}验证') -class Test_C015(unittest.TestCase): +class Test_CAnon014(unittest.TestCase): f'''@Date:: 2024/11/20 @Author:: Arthur Wu @Desc:: @@ -21,7 +21,7 @@ class Test_C015(unittest.TestCase): ''' def setUp(self) -> None: self.timestamp = int(time.time()) - self.ymc = YMClientApi() + self.ymc = YMClientApi(ShoppingCartMac) self.yms = YMServiceApi() # 重量放通白名单商品暂未提供 self.weight_to_whitelist_goods = WeightToWhitelistGoods @@ -30,7 +30,7 @@ class Test_C015(unittest.TestCase): "StoreId": MarketAndStoreDetails["putStoreId"][0] } - def test_C015_NonVipReturnWeightOfTheProducte(self): + def test_CAnon014_ReturnWeightOfTheProducte(self): allure.dynamic.description(f"描述:{DescName}") allure.step("[前置条件]:先调用管理平台接口,将指定商品添加到重量放通白名单中") pre_respomse = self.yms.add_weight_to_whitelist( @@ -49,9 +49,13 @@ class Test_C015(unittest.TestCase): allure.step("步骤3:获取重量放通白名单商品信息") GoodsInfoData1 = self.ymc.get_goods_info(self.weight_to_whitelist_goods["GoodsInputcode"]) + LOGGER.info(f"---获取的商品信息为:{GoodsInfoData1}") + if GoodsInfoData1['data']['weight'] == 0: + GoodsInfoData1['data']['weight'] = 400 if GoodsInfoData1['msg'] != '加购商品不存在': allure.step("步骤4:加购白名单商品") - AddGoodsResp = self.ymc.add_cart_goods(GoodsInfoData1, 5, LoginData) + AddGoodsResp = self.ymc.add_cart_goods(GoodsInfoData1, 1, LoginData) + LOGGER.info(f"---加购商品返回结果:{AddGoodsResp}") ''' step2:随机退购一个商品,并结算 ''' allure.step("\n步骤5:退购一件商品") @@ -64,12 +68,15 @@ class Test_C015(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() else: LOGGER.info(f"---添加商品 {self.weight_to_whitelist_goods['GoodsInputcode']} " f"到重量放通白名单失败") + raise Exception(f"---添加商品 {self.weight_to_whitelist_goods['GoodsInputcode']} " + f"到重量放通白名单失败") if __name__ == '__main__': diff --git a/YiMao/scripts/BusiScenarios/test_C001_NonLoginCheckADs.py b/YiMao/scripts/BusiScenarios/test_CNoLogin001_CheckADs.py similarity index 80% rename from YiMao/scripts/BusiScenarios/test_C001_NonLoginCheckADs.py rename to YiMao/scripts/BusiScenarios/test_CNoLogin001_CheckADs.py index 5150fb9..c0686eb 100644 --- a/YiMao/scripts/BusiScenarios/test_C001_NonLoginCheckADs.py +++ b/YiMao/scripts/BusiScenarios/test_CNoLogin001_CheckADs.py @@ -6,11 +6,12 @@ import unittest,allure,time from configs.globalObj import LOGGER from YiMao.businessFunc.ClientApiLib import YMClientApi +from YiMao.data.WuShangSceneTestData import * -DescName = "001-购物车客户端-广告" +DescName = "NoLogin001-购物车客户端-广告" @allure.story(f'[场景测试] {DescName}验证') -class Test_C001(unittest.TestCase): +class Test_CNoLogin001(unittest.TestCase): f'''@Date:: 2024/11/15 @Author:: Arthur Wu @Desc:: @@ -18,9 +19,9 @@ class Test_C001(unittest.TestCase): ''' def setUp(self) -> None: self.timestamp = int(time.time()) - self.ymc = YMClientApi() + self.ymc = YMClientApi(ShoppingCartMac) - def test_C001_NonLoginCheckADs(self): + def test_CNoLogin001_CheckADs(self): allure.dynamic.description(f"描述:{DescName}") AdListData = self.ymc.get_ads_list() if "error_msg" not in AdListData: diff --git a/YiMao/scripts/BusiScenarios/test_C016_NonToVipAddShoppingBagAndSettlePayment.py b/YiMao/scripts/BusiScenarios/test_CVip001_AddShoppingBagAndSettlePayment.py similarity index 87% rename from YiMao/scripts/BusiScenarios/test_C016_NonToVipAddShoppingBagAndSettlePayment.py rename to YiMao/scripts/BusiScenarios/test_CVip001_AddShoppingBagAndSettlePayment.py index 80481cf..83a0552 100644 --- a/YiMao/scripts/BusiScenarios/test_C016_NonToVipAddShoppingBagAndSettlePayment.py +++ b/YiMao/scripts/BusiScenarios/test_CVip001_AddShoppingBagAndSettlePayment.py @@ -9,9 +9,9 @@ from YiMao.businessFunc.ClientApiLib import YMClientApi from YiMao.data.WuShangSceneTestData import * -DescName = "016-游客转会员登录,加购购物袋,并结算" +DescName = "Vip001-游客转会员登录,加购购物袋,并结算" @allure.story(f'[场景测试] {DescName}验证') -class Test_C016_NonToVipAddShoppingBagAndSettlePayment(unittest.TestCase): +class Test_CVip001_AddShoppingBagAndSettlePayment(unittest.TestCase): f'''@Date:: 2024/11/20 @Author:: Arthur Wu @Desc:: @@ -21,12 +21,12 @@ class Test_C016_NonToVipAddShoppingBagAndSettlePayment(unittest.TestCase): ''' def setUp(self) -> None: self.timestamp = int(time.time()) - self.ymc = YMClientApi() + self.ymc = YMClientApi(ShoppingCartMac) self.vip_phone_num = VIPPhoneNumber self.goodsbag_mid = GoodsBagInputcode_mid self.goodsbag_max = GoodsBagInputcode_max - def test_C01601_AddMidShoppingbagsForPurchase(self): + def test_CVip00101_AddMidShoppingbagsForPurchase(self): allure.dynamic.description(f"描述:加购中号购物袋") allure.step("步骤1:session开始") self.ymc.session_start() @@ -50,7 +50,7 @@ class Test_C016_NonToVipAddShoppingBagAndSettlePayment(unittest.TestCase): else: LOGGER.info(f"---购物袋 {self.goodsbag_mid} 不存在") - def test_C01602_AddMaxShoppingbagsForPurchase(self): + def test_CVip00102_AddMaxShoppingbagsForPurchase(self): allure.dynamic.description("描述:加购大号购物袋") allure.step("步骤1:session开始") self.ymc.session_start() @@ -73,9 +73,9 @@ class Test_C016_NonToVipAddShoppingBagAndSettlePayment(unittest.TestCase): self.ymc.request_order_settlement(LoginData) else: LOGGER.info(f"---购物袋 {self.goodsbag_max} 不存在") + raise Exception(f"购物袋 {self.goodsbag_max} 不存在") + if __name__ == '__main__': - unittest.main(verbosity=2) - - + unittest.main(verbosity=2) \ No newline at end of file diff --git a/YiMao/scripts/BusiScenarios/test_C017_NonToVipAddNonDiscountedProductsForPurchase.py b/YiMao/scripts/BusiScenarios/test_CVip002_AddNonDiscountedProductsForPurchase.py similarity index 86% rename from YiMao/scripts/BusiScenarios/test_C017_NonToVipAddNonDiscountedProductsForPurchase.py rename to YiMao/scripts/BusiScenarios/test_CVip002_AddNonDiscountedProductsForPurchase.py index 7b6651f..4b9e521 100644 --- a/YiMao/scripts/BusiScenarios/test_C017_NonToVipAddNonDiscountedProductsForPurchase.py +++ b/YiMao/scripts/BusiScenarios/test_CVip002_AddNonDiscountedProductsForPurchase.py @@ -9,9 +9,9 @@ from YiMao.businessFunc.ClientApiLib import YMClientApi from YiMao.data.WuShangSceneTestData import * -DescName = "017-游客转会员登录,加购普通商品,并结算" +DescName = "Vip002-游客转会员登录,加购普通商品,并结算" @allure.story(f'[场景测试] {DescName}验证') -class Test_C017(unittest.TestCase): +class Test_CVip002(unittest.TestCase): f'''@Date:: 2024/11/15 @Author:: Arthur Wu @Desc:: test_C003_NonVipAddNonDiscountedProductsForPurchase @@ -21,11 +21,11 @@ class Test_C017(unittest.TestCase): ''' def setUp(self) -> None: self.timestamp = int(time.time()) - self.ymc = YMClientApi() + self.ymc = YMClientApi(ShoppingCartMac) self.vip_phone_num = VIPPhoneNumber self.NormalGoodsInputcode01 = NormalGoodsInputcode01 # 乐事薯片 - def test_C017_NonToVipAddNonDiscountedProductsForPurchase(self): + def test_CVip002_AddNonDiscountedProductsForPurchase(self): allure.dynamic.description(f"描述:{DescName}") allure.step("步骤1:session开始") self.ymc.session_start() @@ -48,6 +48,7 @@ class Test_C017(unittest.TestCase): self.ymc.request_order_settlement(LoginData) else: LOGGER.info(f"---商品 {self.NormalGoodsInputcode01} 不存在") + raise Exception(f"---商品 {self.NormalGoodsInputcode01} 不存在") if __name__ == '__main__': diff --git a/YiMao/scripts/BusiScenarios/test_C018_NonToVipAddMemberPproductsForPurchase.py b/YiMao/scripts/BusiScenarios/test_CVip003_AddMemberProductsForPurchase.py similarity index 87% rename from YiMao/scripts/BusiScenarios/test_C018_NonToVipAddMemberPproductsForPurchase.py rename to YiMao/scripts/BusiScenarios/test_CVip003_AddMemberProductsForPurchase.py index cbcc01b..2683ecf 100644 --- a/YiMao/scripts/BusiScenarios/test_C018_NonToVipAddMemberPproductsForPurchase.py +++ b/YiMao/scripts/BusiScenarios/test_CVip003_AddMemberProductsForPurchase.py @@ -9,9 +9,9 @@ from YiMao.businessFunc.ClientApiLib import YMClientApi from YiMao.data.WuShangSceneTestData import * -DescName = "018-游客转会员登录,加购会员商品,并结算" +DescName = "Vip003-游客转会员登录,加购会员商品,并结算" @allure.story(f'[场景测试] {DescName}验证') -class Test_C018(unittest.TestCase): +class Test_CVip003(unittest.TestCase): f'''@Date:: 2024/11/20 @Author:: Arthur Wu @Desc:: @@ -21,12 +21,12 @@ class Test_C018(unittest.TestCase): ''' def setUp(self) -> None: self.timestamp = int(time.time()) - self.ymc = YMClientApi() + self.ymc = YMClientApi(ShoppingCartMac) # 会员有优惠商品暂未提供 self.vip_phone_num = VIPPhoneNumber self.vip_goods_inputcode = VipGoodsInputcode # 统一番茄牛肉面 - def test_C018_NonToVipAddMemberPproductsForPurchase(self): + def test_CVip003_AddMemberProductsForPurchase(self): allure.dynamic.description(f"描述:{DescName}") allure.step("步骤1:session开始") self.ymc.session_start() @@ -49,6 +49,7 @@ class Test_C018(unittest.TestCase): self.ymc.request_order_settlement(LoginData) else: LOGGER.info(f"---商品 {self.vip_goods_inputcode} 不存在") + raise Exception(f"---商品 {self.vip_goods_inputcode} 不存在") if __name__ == '__main__': diff --git a/YiMao/scripts/BusiScenarios/test_C019_NonToVipAddMultipleItemsForPurchase.py b/YiMao/scripts/BusiScenarios/test_CVip004_AddMultipleItemsForPurchase.py similarity index 86% rename from YiMao/scripts/BusiScenarios/test_C019_NonToVipAddMultipleItemsForPurchase.py rename to YiMao/scripts/BusiScenarios/test_CVip004_AddMultipleItemsForPurchase.py index ec2ade7..db5d8e8 100644 --- a/YiMao/scripts/BusiScenarios/test_C019_NonToVipAddMultipleItemsForPurchase.py +++ b/YiMao/scripts/BusiScenarios/test_CVip004_AddMultipleItemsForPurchase.py @@ -9,9 +9,9 @@ from YiMao.businessFunc.ClientApiLib import YMClientApi from YiMao.data.WuShangSceneTestData import * -DescName = "019-游客转会员登录,加购多件商品,并结算" +DescName = "Vip004-游客转会员登录,加购多件商品,并结算" @allure.story(f'[场景测试] {DescName}验证') -class Test_C019(unittest.TestCase): +class Test_CVip004(unittest.TestCase): f'''@Date:: 2024/11/15 @Author:: Arthur Wu @Desc:: @@ -20,12 +20,12 @@ class Test_C019(unittest.TestCase): ''' def setUp(self) -> None: self.timestamp = int(time.time()) - self.ymc = YMClientApi() + self.ymc = YMClientApi(ShoppingCartMac) self.vip_phone_num = VIPPhoneNumber self.goods_inputcode1 = NormalGoodsInputcode01 # 乐事薯片 self.goods_inputcode2 = NormalGoodsInputcode02 # 统一番茄牛肉面 - def test_C019_NonToVipAddMultipleItemsForPurchase(self): + def test_CVip004_AddMultipleItemsForPurchase(self): allure.dynamic.description(f"描述:{DescName}") allure.step("步骤1:session开始") self.ymc.session_start() @@ -53,8 +53,10 @@ class Test_C019(unittest.TestCase): self.ymc.request_order_settlement(LoginData) else: LOGGER.info(f"---商品 {self.goods_inputcode2} 不存在") + raise AssertionError(f"---商品 {self.goods_inputcode2} 不存在") else: LOGGER.info(f"---商品 {self.goods_inputcode1} 不存在") + raise AssertionError(f"---商品 {self.goods_inputcode1} 不存在") if __name__ == '__main__': diff --git a/YiMao/scripts/BusiScenarios/test_CVip005_AddDiscountedProductsForPurchase.py b/YiMao/scripts/BusiScenarios/test_CVip005_AddDiscountedProductsForPurchase.py new file mode 100644 index 0000000..ebef928 --- /dev/null +++ b/YiMao/scripts/BusiScenarios/test_CVip005_AddDiscountedProductsForPurchase.py @@ -0,0 +1,56 @@ +# !/usr/bin/python +# -*- coding: utf-8 -*- +# @Author:: Arthur Wu +# @Description:: 游客转会员登录,加购打折商品,并结算 +# @Date:: 2024/11/21 +import unittest,allure,time +from configs.globalObj import LOGGER +from YiMao.businessFunc.ClientApiLib import YMClientApi +from YiMao.data.WuShangSceneTestData import * + + +DescName = "Vip005-游客转会员登录,加购打折商品,并结算" +@allure.story(f'[场景测试] {DescName}验证') +class Test_CVip005(unittest.TestCase): + f'''@Date:: 2024/11/21 + @Author:: Arthur Wu + @Desc:: + [购物车客户端] {DescName} + 1、武商测试环境,会员有优惠商品inputcode为: + !!!!折扣商品暂未提供 + ''' + def setUp(self) -> None: + self.timestamp = int(time.time()) + self.ymc = YMClientApi(ShoppingCartMac) + # 折扣商品暂未提供 + self.vip_phone_num = VIPPhoneNumber + self.sale_goods_inputCode = SaleGoodsInputCode # 乐事薯片 + + def test_CVip005_AddDiscountedProductsForPurchase(self): + allure.dynamic.description(f"描述:{DescName}") + 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:获取折扣商品信息") + GoodsInfoData = self.ymc.get_goods_info(InputCode=self.sale_goods_inputCode) + if GoodsInfoData['msg'] != '加购商品不存在': + allure.step("步骤4:加购折扣商品") + self.ymc.add_cart_goods(GoodsInfoData, 1, LoginData) + allure.step("步骤5:获取购物车商品信息") + self.ymc.get_cart_goods_info([GoodsInfoData]) + allure.step("步骤6:请求订单结算") + self.ymc.request_order_settlement(LoginData) + else: + LOGGER.info(f"---商品 {self.sale_goods_inputCode} 不存在") + raise Exception(f"---商品 {self.sale_goods_inputCode} 不存在") + + +if __name__ == '__main__': + unittest.main(verbosity=2) \ No newline at end of file diff --git a/YiMao/scripts/BusiScenarios/test_CVip006_AddPromotionalWhitelistProducts.py b/YiMao/scripts/BusiScenarios/test_CVip006_AddPromotionalWhitelistProducts.py new file mode 100644 index 0000000..db6f0f9 --- /dev/null +++ b/YiMao/scripts/BusiScenarios/test_CVip006_AddPromotionalWhitelistProducts.py @@ -0,0 +1,78 @@ +# !/usr/bin/python +# -*- coding: utf-8 -*- +# @Author:: Arthur Wu +# @Description:: 游客转会员登录,加购促销白名单商品,并结算 +# @Date:: 2024/11/21 +import unittest,allure,time +from configs.globalObj import LOGGER +from YiMao.businessFunc.ClientApiLib import YMClientApi +from YiMao.businessFunc.ServiceApiLib import YMServiceApi +from YiMao.data.WuShangSceneTestData import * + + +DescName = "Vip006-游客转会员登录,加购促销白名单商品,并结算" +@allure.story(f'[场景测试] {DescName}验证') +class Test_CVip006(unittest.TestCase): + f'''@Date:: 2024/11/15 + @Author:: Arthur Wu + @Desc:: + [购物车客户端] {DescName} + 1、武商测试环境,促销白名单商品inputcode为: + 6925303796426 + ''' + def setUp(self) -> None: + 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 = { + "MarketId": MarketAndStoreDetails["putMarketId"], + "StoreId": MarketAndStoreDetails["putStoreId"][0] + } + + def test_CVip006_AddPromotionalWhitelistProducts(self): + allure.dynamic.description(f"描述:{DescName}") + allure.step("[前置条件]:先调用管理平台接口,将指定商品添加到促销白名单中") + pre_respomse = self.yms.add_promotional_product_whitelist( + self.promotional_whitelist_goods, self.market_and_store_info + ) + if pre_respomse['data'] is not None: + LOGGER.info(f"---商品 {self.promotional_whitelist_goods['GoodsInputcode']} " + f"已添加到促销白名单中") + allure.step("[业务步骤]:再调用客户端接口,执行加购操作") + 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:获取白名单商品信息") + GoodsInfoData1 = self.ymc.get_goods_info(self.promotional_whitelist_goods["GoodsInputcode"]) + if GoodsInfoData1['msg'] != '加购商品不存在': + allure.step("步骤4:加购白名单商品") + self.ymc.add_cart_goods(GoodsInfoData1, 1, LoginData) + allure.step("步骤5:获取购物车商品信息") + self.ymc.get_cart_goods_info([GoodsInfoData1]) + allure.step("步骤6:请求订单结算") + 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() + else: + LOGGER.info(f"---添加商品 {self.promotional_whitelist_goods['GoodsInputcode']} " + f"到促销白名单失败") + raise Exception(f"---添加商品 {self.promotional_whitelist_goods['GoodsInputcode']} " + f"到促销白名单失败") + + +if __name__ == '__main__': + unittest.main(verbosity=2) \ No newline at end of file diff --git a/YiMao/scripts/BusiScenarios/test_CVip007_AddWeightToTheProduct.py b/YiMao/scripts/BusiScenarios/test_CVip007_AddWeightToTheProduct.py new file mode 100644 index 0000000..b6f802d --- /dev/null +++ b/YiMao/scripts/BusiScenarios/test_CVip007_AddWeightToTheProduct.py @@ -0,0 +1,79 @@ +# !/usr/bin/python +# -*- coding: utf-8 -*- +# @Author:: Arthur Wu +# @Description:: 游客转会员登录,加购重量放通商品,并结算 +# @Date:: 2024/11/21 +import unittest,allure,time +from configs.globalObj import LOGGER +from YiMao.businessFunc.ClientApiLib import YMClientApi +from YiMao.businessFunc.ServiceApiLib import YMServiceApi +from YiMao.data.WuShangSceneTestData import * + + +DescName = "Vip007-游客转会员登录,加购重量放通商品,并结算" +@allure.story(f'[场景测试] {DescName}验证') +class Test_CVip007(unittest.TestCase): + f'''@Date:: 2024/11/15 + @Author:: Arthur Wu + @Desc:: + [购物车客户端] {DescName} + 1、武商测试环境,重量放通商品inputcode为: + 6924743915848 + ''' + def setUp(self) -> None: + 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 = { + "MarketId": MarketAndStoreDetails["putMarketId"], + "StoreId": MarketAndStoreDetails["putStoreId"][0] + } + + def test_CVip007_AddWeightToTheProduct(self): + allure.dynamic.description(f"描述:{DescName}") + allure.step("[前置条件]:先调用管理平台接口,将指定商品添加到重量放通白名单中") + pre_respomse = self.yms.add_weight_to_whitelist( + self.weight_to_whitelist_goods, self.market_and_store_info + ) + if pre_respomse['data'] is not None: + LOGGER.info(f"---商品 {self.weight_to_whitelist_goods['GoodsInputcode']} " + f"已添加到重量放通白名单中") + ''' 2-再调用客户端接口,执行加购操作 ''' + allure.step("[业务步骤]:再调用客户端接口,执行加购操作") + 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:获取白名单商品信息") + GoodsInfoData1 = self.ymc.get_goods_info(self.weight_to_whitelist_goods["GoodsInputcode"]) + if GoodsInfoData1['msg'] != '加购商品不存在': + allure.step("步骤4:加购白名单商品") + self.ymc.add_cart_goods(GoodsInfoData1, 1, LoginData) + allure.step("步骤5:获取购物车商品信息") + self.ymc.get_cart_goods_info([GoodsInfoData1]) + allure.step("步骤6:请求订单结算") + 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() + else: + LOGGER.info(f"---添加商品 {self.weight_to_whitelist_goods['GoodsInputcode']} " + f"到重量放通白名单失败") + raise Exception(f"---添加商品 {self.weight_to_whitelist_goods['GoodsInputcode']} " + f"到重量放通白名单失败") + + +if __name__ == '__main__': + unittest.main(verbosity=2) \ No newline at end of file diff --git a/YiMao/scripts/BusiScenarios/test_CVip008_ReturnShoppingBag.py b/YiMao/scripts/BusiScenarios/test_CVip008_ReturnShoppingBag.py new file mode 100644 index 0000000..3f58c50 --- /dev/null +++ b/YiMao/scripts/BusiScenarios/test_CVip008_ReturnShoppingBag.py @@ -0,0 +1,70 @@ +# !/usr/bin/python +# -*- coding: utf-8 -*- +# @Author:: Arthur Wu +# @Description:: 游客转会员登录,加购2个购物袋,退购一个购物袋,并结算 +# @Date:: 2024/11/21 +import unittest,allure,time +from configs.globalObj import LOGGER +from YiMao.businessFunc.ClientApiLib import YMClientApi +from YiMao.data.WuShangSceneTestData import * + + +DescName = "Vip008-游客转会员登录,加购2个购物袋,退购一个购物袋,并结算" +@allure.story(f'[场景测试] {DescName}验证') +class Test_CVip008(unittest.TestCase): + f'''@Date:: 2024/11/20 + @Author:: Arthur Wu + @Desc:: + [购物车客户端] {DescName} + 1、武商测试环境,购物袋的 inputcode 分别为: + ''' + def setUp(self) -> None: + self.timestamp = int(time.time()) + self.ymc = YMClientApi(ShoppingCartMac) + self.vip_phone_num = VIPPhoneNumber + self.shoppingbag_mid = GoodsBagInputcode_mid # 乐事薯片 + self.shoppingbag_max = GoodsBagInputcode_max # 统一番茄牛肉面 + + def test_CVip008_ReturnShoppingBag(self): + allure.dynamic.description(f"描述:{DescName}") + 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) + + '''step1:加购商品x,分别加购x件''' + allure.step("步骤3:获取商品1信息") + GetGoodsInfoResp_01 = self.ymc.get_goods_info(InputCode=self.shoppingbag_mid) + if GetGoodsInfoResp_01['msg'] != '加购商品不存在': + allure.step("步骤4:添加商品1") + self.ymc.add_cart_goods(GetGoodsInfoResp_01, 2, LoginData) + allure.step("步骤5:获取商品2信息") + GetGoodsInfoResp_02 = self.ymc.get_goods_info(InputCode=self.shoppingbag_max) + if GetGoodsInfoResp_02['msg'] != '加购商品不存在': + allure.step("步骤6:添加商品2") + AddGoodsResp = self.ymc.add_cart_goods(GetGoodsInfoResp_02, 2, LoginData) + + ''' step2:随机退购一个商品,并结算 ''' + allure.step("\n步骤7:退购一件商品") + GetGoodsInfoList = [GetGoodsInfoResp_01, GetGoodsInfoResp_02] + self.ymc.delete_shopping_bag(GetGoodsInfoList, LoginData, AddGoodsResp) + + allure.step("步骤8:获取购物车商品信息") + self.ymc.get_cart_goods_info([GetGoodsInfoResp_01, GetGoodsInfoResp_02]) + allure.step("步骤9:请求订单结算") + self.ymc.request_order_settlement(LoginData) + else: + LOGGER.info(f"---商品 {self.shoppingbag_max} 不存在") + raise AssertionError(f"---商品 {self.shoppingbag_max} 不存在") + else: + LOGGER.info(f"---商品 {self.shoppingbag_mid} 不存在") + raise AssertionError(f"---商品 {self.shoppingbag_mid} 不存在") + + +if __name__ == '__main__': + unittest.main(verbosity=2) \ No newline at end of file diff --git a/YiMao/scripts/BusiScenarios/test_CVip009_ReturnPurchaseOfOrdinaryGoods.py b/YiMao/scripts/BusiScenarios/test_CVip009_ReturnPurchaseOfOrdinaryGoods.py new file mode 100644 index 0000000..579ae40 --- /dev/null +++ b/YiMao/scripts/BusiScenarios/test_CVip009_ReturnPurchaseOfOrdinaryGoods.py @@ -0,0 +1,70 @@ +# !/usr/bin/python +# -*- coding: utf-8 -*- +# @Author:: Arthur Wu +# @Description:: 游客转会员登录,加购2个普通商品,退购一个,并结算 +# @Date:: 2024/11/21 +import unittest,allure,time +from configs.globalObj import LOGGER +from YiMao.businessFunc.ClientApiLib import YMClientApi +from YiMao.data.WuShangSceneTestData import * + + +DescName = "Vip009-游客转会员登录,加购2个普通商品,退购一个,并结算" +@allure.story(f'[场景测试] {DescName}验证') +class Test_CVip009(unittest.TestCase): + f'''@Date:: 2024/11/20 + @Author:: Arthur Wu + @Desc:: + [购物车客户端] {DescName} + 1、武商测试环境,2个普通商品 inputcode 分别为: + ''' + def setUp(self) -> None: + self.timestamp = int(time.time()) + self.ymc = YMClientApi(ShoppingCartMac) + self.vip_phone_num = VIPPhoneNumber + self.goods_01 = NormalGoodsInputcode01 # 乐事薯片 + self.goods_02 = NormalGoodsInputcode02 # 统一番茄牛肉面 + + def test_CVip009_ReturnPurchaseOfOrdinaryGoods(self): + allure.dynamic.description(f"描述:{DescName}") + 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) + + '''step1:加购商品x,分别加购x件''' + allure.step("步骤3:获取商品1信息") + GetGoodsInfoResp_01 = self.ymc.get_goods_info(InputCode=self.goods_01) + if GetGoodsInfoResp_01['msg'] != '加购商品不存在': + allure.step("步骤4:添加商品1") + self.ymc.add_cart_goods(GetGoodsInfoResp_01, 1, LoginData) + allure.step("步骤5:获取商品2信息") + GetGoodsInfoResp_02 = self.ymc.get_goods_info(InputCode=self.goods_02) + if GetGoodsInfoResp_02['msg'] != '加购商品不存在': + allure.step("步骤6:添加商品2") + AddGoodsResp = self.ymc.add_cart_goods(GetGoodsInfoResp_02, 1, LoginData) + + ''' step2:随机退购一个商品,并结算 ''' + allure.step("\n步骤7:退购一件商品") + GetGoodsInfoList = [GetGoodsInfoResp_01, GetGoodsInfoResp_02] + self.ymc.delete_cart_goods(GetGoodsInfoList, LoginData, AddGoodsResp) + + allure.step("步骤8:获取购物车商品信息") + self.ymc.get_cart_goods_info([GetGoodsInfoResp_01, GetGoodsInfoResp_02]) + allure.step("步骤9:请求订单结算") + self.ymc.request_order_settlement(LoginData) + else: + LOGGER.info(f"---商品 {self.goods_02} 不存在") + raise AssertionError(f"---商品 {self.goods_02} 不存在") + else: + LOGGER.info(f"---商品 {self.goods_01} 不存在") + raise AssertionError(f"---商品 {self.goods_01} 不存在") + + +if __name__ == '__main__': + unittest.main(verbosity=2) \ No newline at end of file diff --git a/YiMao/scripts/BusiScenarios/test_CVip010_ReturnOfMemberProducts.py b/YiMao/scripts/BusiScenarios/test_CVip010_ReturnOfMemberProducts.py new file mode 100644 index 0000000..05b4ccb --- /dev/null +++ b/YiMao/scripts/BusiScenarios/test_CVip010_ReturnOfMemberProducts.py @@ -0,0 +1,70 @@ +# !/usr/bin/python +# -*- coding: utf-8 -*- +# @Author:: Arthur Wu +# @Description:: 游客转会员登录,加购2个会员商品,退购一个,并结算 +# @Date:: 2024/11/21 +import unittest,allure,time +from configs.globalObj import LOGGER +from YiMao.businessFunc.ClientApiLib import YMClientApi +from YiMao.data.WuShangSceneTestData import * + + +DescName = "Vip010-游客转会员登录,加购2个会员商品,退购一个,并结算" +@allure.story(f'[场景测试] {DescName}验证') +class Test_CVip010(unittest.TestCase): + f'''@Date:: 2024/11/20 + @Author:: Arthur Wu + @Desc:: + [购物车客户端] {DescName} + 1、武商测试环境,2个会员商品 inputcode 分别为: + ''' + def setUp(self) -> None: + self.timestamp = int(time.time()) + self.ymc = YMClientApi(ShoppingCartMac) + self.vip_phone_num = VIPPhoneNumber + self.vip_goods_01 = VipGoodsInputcode # 乐事薯片 + self.vip_goods_02 = VipGoodsInputcode02 # 统一番茄牛肉面 + + def test_CVip010_ReturnOfMemberProducts(self): + allure.dynamic.description(f"描述:{DescName}") + 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) + + '''step1:加购商品x,分别加购x件''' + allure.step("步骤3:获取商品1信息") + GetGoodsInfoResp_01 = self.ymc.get_goods_info(InputCode=self.vip_goods_01) + if GetGoodsInfoResp_01['msg'] != '加购商品不存在': + allure.step("步骤4:添加商品1") + self.ymc.add_cart_goods(GetGoodsInfoResp_01, 3, LoginData) + allure.step("步骤5:获取商品2信息") + GetGoodsInfoResp_02 = self.ymc.get_goods_info(InputCode=self.vip_goods_02) + if GetGoodsInfoResp_02['msg'] != '加购商品不存在': + allure.step("步骤6:添加商品2") + AddGoodsResp = self.ymc.add_cart_goods(GetGoodsInfoResp_02, 1, LoginData) + + ''' step2:随机退购一个商品,并结算 ''' + allure.step("\n步骤7:退购一件商品") + GetGoodsInfoList = [GetGoodsInfoResp_01, GetGoodsInfoResp_02] + self.ymc.delete_cart_goods(GetGoodsInfoList, LoginData, AddGoodsResp) + + allure.step("步骤8:获取购物车商品信息") + self.ymc.get_cart_goods_info([GetGoodsInfoResp_01, GetGoodsInfoResp_02]) + allure.step("步骤9:请求订单结算") + self.ymc.request_order_settlement(LoginData) + else: + LOGGER.info(f"---商品 {self.vip_goods_02} 不存在") + raise AssertionError(f"---商品 {self.vip_goods_02} 不存在") + else: + LOGGER.info(f"---商品 {self.vip_goods_01} 不存在") + raise AssertionError(f"---商品 {self.vip_goods_01} 不存在") + + +if __name__ == '__main__': + unittest.main(verbosity=2) \ No newline at end of file diff --git a/YiMao/scripts/BusiScenarios/test_CVip011_ReturnOneItemFromMultiplePurchases.py b/YiMao/scripts/BusiScenarios/test_CVip011_ReturnOneItemFromMultiplePurchases.py new file mode 100644 index 0000000..1d95a2a --- /dev/null +++ b/YiMao/scripts/BusiScenarios/test_CVip011_ReturnOneItemFromMultiplePurchases.py @@ -0,0 +1,70 @@ +# !/usr/bin/python +# -*- coding: utf-8 -*- +# @Author:: Arthur Wu +# @Description:: 游客转会员登录,加购多件商品,退购一个商品,并结算 +# @Date:: 2024/11/21 +import unittest,allure,time +from configs.globalObj import LOGGER +from YiMao.businessFunc.ClientApiLib import YMClientApi +from YiMao.data.WuShangSceneTestData import * + + +DescName = "Vip011-游客转会员登录,加购多件商品,退购一个商品,并结算" +@allure.story(f'[场景测试] {DescName}验证') +class Test_CVip011(unittest.TestCase): + f'''@Date:: 2024/11/20 + @Author:: Arthur Wu + @Desc:: + [购物车客户端] {DescName} + 1、武商测试环境,多件商品的 inputcode 分别为: + ''' + def setUp(self) -> None: + self.timestamp = int(time.time()) + self.ymc = YMClientApi(ShoppingCartMac) + self.vip_phone_num = VIPPhoneNumber + self.goods_inputcode1 = NormalGoodsInputcode01 # 乐事薯片 + self.goods_inputcode2 = NormalGoodsInputcode02 # 统一番茄牛肉面 + + def test_CVip011_ReturnOneItemFromMultiplePurchases(self): + allure.dynamic.description(f"描述:{DescName}") + 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) + + '''step1:加购商品x,分别加购x件''' + allure.step("步骤3:获取商品1信息") + GetGoodsInfoResp_01 = self.ymc.get_goods_info(InputCode=self.goods_inputcode1) + if GetGoodsInfoResp_01['msg'] != '加购商品不存在': + allure.step("步骤4:添加商品1") + self.ymc.add_cart_goods(GetGoodsInfoResp_01, 2, LoginData) + allure.step("步骤5:获取商品2信息") + GetGoodsInfoResp_02 = self.ymc.get_goods_info(InputCode=self.goods_inputcode2) + if GetGoodsInfoResp_02['msg'] != '加购商品不存在': + allure.step("步骤6:添加商品2") + AddGoodsResp = self.ymc.add_cart_goods(GetGoodsInfoResp_02, 2, LoginData) + + ''' step2:随机退购一个商品,并结算 ''' + allure.step("\n步骤7:退购一件商品") + GetGoodsInfoList = [GetGoodsInfoResp_01, GetGoodsInfoResp_02] + self.ymc.delete_cart_goods(GetGoodsInfoList, LoginData, AddGoodsResp) + + allure.step("步骤8:获取购物车商品信息") + self.ymc.get_cart_goods_info([GetGoodsInfoResp_01, GetGoodsInfoResp_02]) + allure.step("步骤9:请求订单结算") + self.ymc.request_order_settlement(LoginData) + else: + LOGGER.info(f"---商品 {self.goods_inputcode2} 不存在") + raise AssertionError(f"---商品 {self.goods_inputcode2} 不存在") + else: + LOGGER.info(f"---商品 {self.goods_inputcode1} 不存在") + raise AssertionError(f"---商品 {self.goods_inputcode1} 不存在") + + +if __name__ == '__main__': + unittest.main(verbosity=2) \ No newline at end of file diff --git a/YiMao/scripts/BusiScenarios/test_CVip012_ReturnOfDiscountedProducts.py b/YiMao/scripts/BusiScenarios/test_CVip012_ReturnOfDiscountedProducts.py new file mode 100644 index 0000000..7da7dbe --- /dev/null +++ b/YiMao/scripts/BusiScenarios/test_CVip012_ReturnOfDiscountedProducts.py @@ -0,0 +1,61 @@ +# !/usr/bin/python +# -*- coding: utf-8 -*- +# @Author:: Arthur Wu +# @Description:: 游客转会员登录,加购2个打折商品,退购一个,并结算 +# @Date:: 2024/11/21 +import unittest,allure,time +from configs.globalObj import LOGGER +from YiMao.businessFunc.ClientApiLib import YMClientApi +from YiMao.data.WuShangSceneTestData import * + + +DescName = "Vip012-游客转会员登录,加购2个打折商品,退购一个,并结算" +@allure.story(f'[场景测试] {DescName}验证') +class Test_CVip012(unittest.TestCase): + f'''@Date:: 2024/11/20 + @Author:: Arthur Wu + @Desc:: + [购物车客户端] {DescName} + 1、武商测试环境,2个打折商品 inputcode 分别为: + ''' + def setUp(self) -> None: + self.timestamp = int(time.time()) + self.ymc = YMClientApi(ShoppingCartMac) + self.vip_phone_num = VIPPhoneNumber + self.sale_goods_inputCode = SaleGoodsInputCode # 乐事薯片 + + def test_CVip012_ReturnOfDiscountedProducts(self): + allure.dynamic.description(f"描述:{DescName}") + 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) + + '''step1:加购商品x,分别加购x件''' + allure.step("步骤3:获取商品1信息") + GetGoodsInfoResp_01 = self.ymc.get_goods_info(InputCode=self.sale_goods_inputCode) + if GetGoodsInfoResp_01['msg'] != '加购商品不存在': + allure.step("步骤4:添加商品1") + AddGoodsResp = self.ymc.add_cart_goods(GetGoodsInfoResp_01, 2, LoginData) + + ''' step2:随机退购一个商品,并结算 ''' + 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"---商品 {self.sale_goods_inputCode} 不存在") + raise AssertionError(f"---商品 {self.sale_goods_inputCode} 不存在") + + +if __name__ == '__main__': + unittest.main(verbosity=2) \ No newline at end of file diff --git a/YiMao/scripts/BusiScenarios/test_CVip013_ReturnPromotionWhitelistProducts.py b/YiMao/scripts/BusiScenarios/test_CVip013_ReturnPromotionWhitelistProducts.py new file mode 100644 index 0000000..be189a8 --- /dev/null +++ b/YiMao/scripts/BusiScenarios/test_CVip013_ReturnPromotionWhitelistProducts.py @@ -0,0 +1,88 @@ +# !/usr/bin/python +# -*- coding: utf-8 -*- +# @Author:: Arthur Wu +# @Description:: 游客转会员登录,加购2个促销白名单商品,退购一个,并结算 +# @Date:: 2024/11/21 +import unittest,allure,time +from configs.globalObj import LOGGER +from YiMao.businessFunc.ClientApiLib import YMClientApi +from YiMao.businessFunc.ServiceApiLib import YMServiceApi +from YiMao.data.WuShangSceneTestData import * + + +DescName = "Vip013-游客转会员登录,加购2个促销白名单商品,退购一个,并结算" +@allure.story(f'[场景测试] {DescName}验证') +class Test_CVip013(unittest.TestCase): + f'''@Date:: 2024/11/20 + @Author:: Arthur Wu + @Desc:: + [购物车客户端] {DescName} + 1、武商测试环境,促销白名单商品 inputcode 分别为: + ''' + def setUp(self) -> None: + 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 = { + "MarketId": MarketAndStoreDetails["putMarketId"], + "StoreId": MarketAndStoreDetails["putStoreId"][0] + } + + def test_CVip013_ReturnPromotionWhitelistProducts(self): + allure.dynamic.description(f"描述:{DescName}") + allure.step("[前置条件]:先调用管理平台接口,将指定商品添加到促销白名单中") + pre_respomse = self.yms.add_promotional_product_whitelist( + self.promotional_whitelist_goods, self.market_and_store_info + ) + if pre_respomse['data'] is not None: + LOGGER.info(f"---商品 {self.promotional_whitelist_goods['GoodsInputcode']} " + f"已添加到促销白名单中") + allure.step("[业务步骤]:再调用客户端接口,执行加购操作") + 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) + + '''step1:加购商品x,分别加购x件''' + allure.step("步骤3:获取促销白名单商品信息") + GoodsInfoData1 = self.ymc.get_goods_info(self.promotional_whitelist_goods["GoodsInputcode"]) + LOGGER.info(f"---获取的商品信息为:{GoodsInfoData1}") + if GoodsInfoData1['data']['weight'] == 0: + GoodsInfoData1['data']['weight'] = 300 + if GoodsInfoData1['msg'] != '加购商品不存在': + allure.step("步骤4:加购白名单商品") + AddGoodsResp = self.ymc.add_cart_goods(GoodsInfoData1, 1, LoginData) + LOGGER.info(f"---加购商品返回结果:{AddGoodsResp}") + + ''' step2:随机退购一个商品,并结算 ''' + allure.step("\n步骤5:退购一件商品") + GetGoodsInfoList = [GoodsInfoData1] + self.ymc.delete_cart_goods(GetGoodsInfoList, LoginData, AddGoodsResp) + + allure.step("步骤6:获取购物车商品信息") + self.ymc.get_cart_goods_info([GoodsInfoData1]) + allure.step("步骤7:请求订单结算") + 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() + else: + LOGGER.info(f"---添加商品 {self.promotional_whitelist_goods['GoodsInputcode']} " + f"到促销白名单失败") + raise Exception(f"---添加商品 {self.promotional_whitelist_goods['GoodsInputcode']} " + f"到促销白名单失败") + + +if __name__ == '__main__': + unittest.main(verbosity=2) \ No newline at end of file diff --git a/YiMao/scripts/BusiScenarios/test_CVip014_ReturnWeightOfTheProducte.py b/YiMao/scripts/BusiScenarios/test_CVip014_ReturnWeightOfTheProducte.py new file mode 100644 index 0000000..7ecbcf9 --- /dev/null +++ b/YiMao/scripts/BusiScenarios/test_CVip014_ReturnWeightOfTheProducte.py @@ -0,0 +1,88 @@ +# !/usr/bin/python +# -*- coding: utf-8 -*- +# @Author:: Arthur Wu +# @Description:: 游客转会员登录,加购2个重量放通商品,退购一个,并结算 +# @Date:: 2024/11/21 +import unittest,allure,time +from configs.globalObj import LOGGER +from YiMao.businessFunc.ClientApiLib import YMClientApi +from YiMao.businessFunc.ServiceApiLib import YMServiceApi +from YiMao.data.WuShangSceneTestData import * + + +DescName = "Vip014-游客转会员登录,加购2个重量放通商品,退购一个,并结算" +@allure.story(f'[场景测试] {DescName}验证') +class Test_CVip014(unittest.TestCase): + f'''@Date:: 2024/11/20 + @Author:: Arthur Wu + @Desc:: + [购物车客户端] {DescName} + 1、武商测试环境,重量放通白名单商品 inputcode 分别为: + ''' + def setUp(self) -> None: + 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 = { + "MarketId": MarketAndStoreDetails["putMarketId"], + "StoreId": MarketAndStoreDetails["putStoreId"][0] + } + + def test_CVip014_ReturnWeightOfTheProducte(self): + allure.dynamic.description(f"描述:{DescName}") + allure.step("[前置条件]:先调用管理平台接口,将指定商品添加到重量放通白名单中") + pre_respomse = self.yms.add_weight_to_whitelist( + self.weight_to_whitelist_goods, self.market_and_store_info + ) + if pre_respomse['data'] is not None: + LOGGER.info(f"---商品 {self.weight_to_whitelist_goods['GoodsInputcode']} " + f"已添加到重量放通白名单中") + ''' 2-再调用客户端接口,执行加购操作 ''' + allure.step("[业务步骤]:再调用客户端接口,执行加购操作") + 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:获取重量放通白名单商品信息") + GoodsInfoData1 = self.ymc.get_goods_info(self.weight_to_whitelist_goods["GoodsInputcode"]) + LOGGER.info(f"---获取的商品信息为:{GoodsInfoData1}") + if GoodsInfoData1['data']['weight'] == 0: + GoodsInfoData1['data']['weight'] = 400 + if GoodsInfoData1['msg'] != '加购商品不存在': + allure.step("步骤4:加购白名单商品") + AddGoodsResp = self.ymc.add_cart_goods(GoodsInfoData1, 1, LoginData) + LOGGER.info(f"---加购商品返回结果:{AddGoodsResp}") + + ''' step2:随机退购一个商品,并结算 ''' + allure.step("\n步骤5:退购一件商品") + GetGoodsInfoList = [GoodsInfoData1] + self.ymc.delete_cart_goods(GetGoodsInfoList, LoginData, AddGoodsResp) + + allure.step("步骤6:获取购物车商品信息") + self.ymc.get_cart_goods_info([GoodsInfoData1]) + allure.step("步骤7:请求订单结算") + 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() + else: + LOGGER.info(f"---添加商品 {self.weight_to_whitelist_goods['GoodsInputcode']} " + f"到重量放通白名单失败") + raise Exception(f"---添加商品 {self.weight_to_whitelist_goods['GoodsInputcode']} " + f"到重量放通白名单失败") + + +if __name__ == '__main__': + unittest.main(verbosity=2) \ No newline at end of file diff --git a/commons/EngineX.py b/commons/EngineX.py index 6ae2e24..5c98b39 100644 --- a/commons/EngineX.py +++ b/commons/EngineX.py @@ -97,8 +97,8 @@ class NotificationModule(): "Debug": "7aedbee7239870e3e653748a2889d8bf063c61efa9213c7099bd57476066dc86", "Formal": "80b026022a28166cfc9eebaf8f6a880cc06f56a14b8803e8d67e7fb3cb05844e" } - # self.urlInfo = f'https://oapi.dingtalk.com/robot/send?access_token={datainfo["Debug"]}' - self.urlInfo = f'https://oapi.dingtalk.com/robot/send?access_token={datainfo["Formal"]}' + self.urlInfo = f'https://oapi.dingtalk.com/robot/send?access_token={datainfo["Debug"]}' + # self.urlInfo = f'https://oapi.dingtalk.com/robot/send?access_token={datainfo["Formal"]}' self.ReportUrl = ProCfgData["ReportsURL"] self.ExecutionEnvironment = ProCfgData["ExecutionEnv"] diff --git a/commons/SignatureYM.py b/commons/SignatureYM.py index abb9970..89db7dc 100644 --- a/commons/SignatureYM.py +++ b/commons/SignatureYM.py @@ -30,7 +30,7 @@ class SignatureYM(): return headers class SignatureYM2(): - def __init__(self, Mac= '70:f7:54:07:a6:c0'): + def __init__(self, ShoppingCartMac= '70:f7:54:07:a6:c0'): def __sission_id(): import random, time def generate_24_digit_random_integer(): @@ -45,7 +45,7 @@ class SignatureYM2(): random_integer = generate_24_digit_random_integer() return str(random_integer) self.SessionId = __sission_id() - self.Mac = Mac + self.Mac = ShoppingCartMac def _headers(self): headers = {