From c1dfa4af8dabea8d0f25c43508e02b34768a0440 Mon Sep 17 00:00:00 2001 From: zhanhuasheng Date: Mon, 29 Apr 2024 11:44:08 +0800 Subject: [PATCH] bugfix --- TestCase/setting/test_08_notification.py | 13 +++++ TestData/setting/notification_test_data.py | 5 ++ .../shopifyIntegration_shop_num_select.py | 6 +++ YamlCase/account/account.yaml | 2 +- YamlCase/setting/notification.yaml | 50 +++++++++++++++++++ 5 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 TestCase/setting/test_08_notification.py create mode 100644 TestData/setting/notification_test_data.py create mode 100644 TestFile/setting/shopifyIntegration/shopifyIntegration_shop_num_select.py create mode 100644 YamlCase/setting/notification.yaml diff --git a/TestCase/setting/test_08_notification.py b/TestCase/setting/test_08_notification.py new file mode 100644 index 0000000..ecd83c1 --- /dev/null +++ b/TestCase/setting/test_08_notification.py @@ -0,0 +1,13 @@ +import pytest +from Utils import yaml_handler +from Utils import req_handler +from TestData.setting.notification_test_data import notifycationData + +class TestNotifycation: + + yaml_path = r'setting/notification.yaml' + yaml_data = yaml_handler.yaml_handler.get_case(yaml_path) + @pytest.mark.flaky(reruns=notifycationData.rerun, reruns_delay=notifycationData.rerun_delay) + @pytest.mark.parametrize('case',yaml_data) + def test_notifycation(self,case): + req_handler.ReqHandler.send_requests(case=case,var_class=notifycationData) diff --git a/TestData/setting/notification_test_data.py b/TestData/setting/notification_test_data.py new file mode 100644 index 0000000..94eb282 --- /dev/null +++ b/TestData/setting/notification_test_data.py @@ -0,0 +1,5 @@ +from Utils.global_variate import Global + +class notifycationData(Global): + insert_team_name = 'autotest_insert_team' + insert_room_id = 501307576659487524 \ No newline at end of file diff --git a/TestFile/setting/shopifyIntegration/shopifyIntegration_shop_num_select.py b/TestFile/setting/shopifyIntegration/shopifyIntegration_shop_num_select.py new file mode 100644 index 0000000..025932a --- /dev/null +++ b/TestFile/setting/shopifyIntegration/shopifyIntegration_shop_num_select.py @@ -0,0 +1,6 @@ +from Utils.sql_handler import test_env_conn +from TestData.setting.shopify_integration_test_data import shopifyIntegrationData +shopify_shop_select_sql = f'select * from `shop` where brand_id = {shopifyIntegrationData.brandId} and source in (1,2) and is_delete in (0,2)' +shopify_shop_select_result = test_env_conn.select_many_value(shopify_shop_select_sql) +shopify_shop_num = len(shopify_shop_select_result) +setattr(shopifyIntegrationData, 'shop_num', shopify_shop_num) \ No newline at end of file diff --git a/YamlCase/account/account.yaml b/YamlCase/account/account.yaml index 7172606..9a21a54 100644 --- a/YamlCase/account/account.yaml +++ b/YamlCase/account/account.yaml @@ -47,13 +47,13 @@ api6: url: /api/v1/customerService/updateCustomerServiceAccount method: post data: {"id" : "${userId}" , "localLang" : "${target_language}" , "profile" : "${picUrl}", "v" : "${v}"} - after_sql: /account/account_selectLanguage.py expected: - eq: {"$.code" : 0} api7: title: 检查设置语言 url: /api/v1/customerService/getCustomerServiceInfo?v=${v} + before_sql: /account/account_selectLanguage.py method: get expected: - eq: {"$.code": 0 } diff --git a/YamlCase/setting/notification.yaml b/YamlCase/setting/notification.yaml new file mode 100644 index 0000000..ff3db82 --- /dev/null +++ b/YamlCase/setting/notification.yaml @@ -0,0 +1,50 @@ +api1: + title: 关闭所有消息通知 + url: /api/v1/setting/updateShopSetting + method: post + data: {"item":[{"itemId":102,"itemName":"messageNotifyToAll","itemValue":"0","shopId":"0"},{"itemId":103,"itemName":"messageNotifyToTeam","itemValue":"0","shopId":"0"}],"v":"${v}"} + expected: + - eq: {"$.code": 0} + +api2: + title: 检查是否关闭所有消息通知 + url: /api/v1/setting/getShopSetting?v=${v} + method: get + expected: + - eq: {"$.code": 0} + - eq: {"$.data.settingInfoMap.mapList.0.settings[?(@.itemId == 102)].itemValue": "0"} + - eq: {"$.data.settingInfoMap.mapList.0.settings[?(@.itemId == 103)].itemValue": "0"} + +api3: + title: 开启仅针对分配给您的团队的通知 + url: /api/v1/setting/updateShopSetting + method: post + data: {"item":[{"itemId":102,"itemName":"messageNotifyToAll","itemValue":"0","shopId":"0"},{"itemId":103,"itemName":"messageNotifyToTeam","itemValue":"1","shopId":"0"}],"v":"${v}"} + expected: + - eq: {"$.code": 0} + +api4: + title: 检查是否开启仅针对分配给您的团队的通知 + url: /api/v1/setting/getShopSetting?v=${v} + method: get + expected: + - eq: {"$.code": 0} + - eq: {"$.data.settingInfoMap.mapList.0.settings[?(@.itemId == 102)].itemValue": "0"} + - eq: {"$.data.settingInfoMap.mapList.0.settings[?(@.itemId == 103)].itemValue": "1"} + +api5: + title: 开启所有消息通知 + url: /api/v1/setting/updateShopSetting + method: post + data: {"item":[{"itemId":102,"itemName":"messageNotifyToAll","itemValue":"1","shopId":"0"},{"itemId":103,"itemName":"messageNotifyToTeam","itemValue":"0","shopId":"0"}],"v":"${v}"} + expected: + - eq: {"$.code": 0} + +api6: + title: 检查是否开启所有消息通知 + url: /api/v1/setting/getShopSetting?v=${v} + method: get + expected: + - eq: {"$.code": 0} + - eq: {"$.data.settingInfoMap.mapList.0.settings[?(@.itemId == 102)].itemValue": "1"} + - eq: {"$.data.settingInfoMap.mapList.0.settings[?(@.itemId == 103)].itemValue": "0"} -- GitLab