From cb6f83f4c87883679bdcd1ba5f59e3067a611020 Mon Sep 17 00:00:00 2001 From: zhanhuasheng Date: Fri, 30 Aug 2024 10:49:40 +0800 Subject: [PATCH] bugfix --- TestFile/FAQ/article_list_select.py | 8 ++++---- .../automation/orderflow/orderflow_order_select.py | 14 +++++++++----- YamlCase/FAQ/article_info.yaml | 14 +++++++------- YamlCase/FAQ/article_opreate.yaml | 6 +++--- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/TestFile/FAQ/article_list_select.py b/TestFile/FAQ/article_list_select.py index f2459cc..1024bb7 100644 --- a/TestFile/FAQ/article_list_select.py +++ b/TestFile/FAQ/article_list_select.py @@ -1,13 +1,13 @@ from Utils.sql_handler import test_env_conn from TestData.FAQ.article_info_test_data import articleInfoTestData -all_article_list_select_sql = f'select * from `article` where brand_id = {articleInfoTestData.brandId} and is_delete = 0' -all_article_list_select_result = test_env_conn.select_many_value(all_article_list_select_sql) -all_article_num = len(all_article_list_select_result) +# all_article_list_select_sql = f'select * from `article` where brand_id = {articleInfoTestData.brandId} and is_delete = 0' +# all_article_list_select_result = test_env_conn.select_many_value(all_article_list_select_sql) +# all_article_num = len(all_article_list_select_result) shop_article_list_select_sql = f'select * from `article` where brand_id = {articleInfoTestData.brandId} and shop_id = {articleInfoTestData.shopId} and is_delete = 0' shop_article_list_select_result = test_env_conn.select_many_value(shop_article_list_select_sql) shop_article_num = len(shop_article_list_select_result) -setattr(articleInfoTestData,'all_article_num',all_article_num) +# setattr(articleInfoTestData,'all_article_num',all_article_num) setattr(articleInfoTestData,'shop_article_num',shop_article_num) article = shop_article_list_select_result[0] article_id = article['id'] diff --git a/TestFile/automation/orderflow/orderflow_order_select.py b/TestFile/automation/orderflow/orderflow_order_select.py index bcc5349..7df9a62 100644 --- a/TestFile/automation/orderflow/orderflow_order_select.py +++ b/TestFile/automation/orderflow/orderflow_order_select.py @@ -28,11 +28,15 @@ setattr(orderflowData, 'order_shop_id', str(orderflowData.shopId)) orderflow_select_sql = f'select MAX(rule_id), event_id from `rule_define` where brand_id = {orderflowData.brandId} and status = 1 and child_rule = 0 and rule_cate = 2 group by event_id' orderflow_select_result = test_env_conn.select_many_value(sql=orderflow_select_sql) -for flow in orderflow_select_result: - if flow['event_id'] == 'cq2batf73uvr2vuobf30': - cancel_flow = 1 - elif flow['event_id'] == 'cq1ssgf73uvh93lop2mg': - return_flow = 1 +if orderflow_order_select_result: + for flow in orderflow_select_result: + if flow['event_id'] == 'cq2batf73uvr2vuobf30': + cancel_flow = 1 + elif flow['event_id'] == 'cq1ssgf73uvh93lop2mg': + return_flow = 1 +else: + cancel_flow = 0 + return_flow = 0 setattr(orderflowData, 'cancel_able', True) if financial_status == 'pending' and cancel_flow and cancel_reason == '' else setattr(orderflowData, 'cancel_able', False) setattr(orderflowData, 'return_able', True) if orderflow_order_select_result['is_all_returned'] == 0 and return_flow and financial_status != 'pending' else setattr(orderflowData, 'return_able', False) diff --git a/YamlCase/FAQ/article_info.yaml b/YamlCase/FAQ/article_info.yaml index ca40a5d..58a9409 100644 --- a/YamlCase/FAQ/article_info.yaml +++ b/YamlCase/FAQ/article_info.yaml @@ -1,16 +1,16 @@ api1: title: 检查列表文章数量 - url: /api/v1/helpcenter/buser/GetFaqList?v=${v} + url: /api/v1/helpcenter/buser/GetFaqList?shopId=${shopId}&v=${v} method: get before_sql: FAQ/article_list_select.py expected: - eq: {"$.code": 0} - - exec: {"code" : "assert len(res.json()['data']['articleList']) == ${all_article_num}"} - - exec: {"code" : "assert len([article for article in res.json()['data']['articleList'] if article['shopId'] == ${shopId}]) == ${shop_article_num}"} + - exec: {"code" : "assert len(res.json()['data']['articleList']) == ${shop_article_num}"} +# - exec: {"code" : "assert len([article for article in res.json()['data']['articleList'] if article['shopId'] == ${shopId}]) == ${shop_article_num}"} api2: title: 检查文章信息 - url: /api/v1/helpcenter/buser/GetFaqList?v=${v} + url: /api/v1/helpcenter/buser/GetFaqList?shopId=${shopId}&v=${v} method: get expected: - eq: {"$.code": 0} @@ -45,7 +45,7 @@ api4: api5: title: 检查文章信息 - url: /api/v1/helpcenter/buser/GetFaqList?v=${v} + url: /api/v1/helpcenter/buser/GetFaqList?shopId=${shopId}&v=${v} method: get expected: - eq: { "$.code": 0} @@ -87,7 +87,7 @@ api9: api10: title: 检查文章信息 - url: /api/v1/helpcenter/buser/GetFaqList?v=${v} + url: /api/v1/helpcenter/buser/GetFaqList?shopId=${shopId}&v=${v} method: get expected: - eq: { "$.code": 0} @@ -140,7 +140,7 @@ api15: api16: title: 检查文章信息 - url: /api/v1/helpcenter/buser/GetFaqList?v=${v} + url: /api/v1/helpcenter/buser/GetFaqList?shopId=${shopId}&v=${v} method: get expected: - eq: {"$.code": 0} diff --git a/YamlCase/FAQ/article_opreate.yaml b/YamlCase/FAQ/article_opreate.yaml index 6676f64..45aaebb 100644 --- a/YamlCase/FAQ/article_opreate.yaml +++ b/YamlCase/FAQ/article_opreate.yaml @@ -19,7 +19,7 @@ api2: api3: title: 检查是否新增分类、文章成功 - url: /api/v1/helpcenter/buser/GetFaqList?v=${v} + url: /api/v1/helpcenter/buser/GetFaqList?shopId=${shopId}&v=${v} method: get expected: - eq: {"$.code": 0} @@ -74,7 +74,7 @@ api8: api9: title: 检查文章、分类是否更新成功 - url: /api/v1/helpcenter/buser/GetFaqList?v=${v} + url: /api/v1/helpcenter/buser/GetFaqList?shopId=${shopId}&v=${v} method: get expected: - eq: {"$.code": 0} @@ -106,7 +106,7 @@ api11: api12: title: 检查是否删除成功 - url: /api/v1/helpcenter/buser/GetFaqList?v=${v} + url: /api/v1/helpcenter/buser/GetFaqList?shopId=${shopId}&v=${v} method: get expected: - eq: {"$.code": 0} -- GitLab