Commit cb6f83f4 authored by zhanhuasheng's avatar zhanhuasheng

bugfix

parent 3e90e5a0
from Utils.sql_handler import test_env_conn from Utils.sql_handler import test_env_conn
from TestData.FAQ.article_info_test_data import articleInfoTestData 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_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_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_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_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_list_select_result = test_env_conn.select_many_value(shop_article_list_select_sql)
shop_article_num = len(shop_article_list_select_result) 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) setattr(articleInfoTestData,'shop_article_num',shop_article_num)
article = shop_article_list_select_result[0] article = shop_article_list_select_result[0]
article_id = article['id'] article_id = article['id']
......
...@@ -28,11 +28,15 @@ setattr(orderflowData, 'order_shop_id', str(orderflowData.shopId)) ...@@ -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_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) orderflow_select_result = test_env_conn.select_many_value(sql=orderflow_select_sql)
for flow in orderflow_select_result: if orderflow_order_select_result:
for flow in orderflow_select_result:
if flow['event_id'] == 'cq2batf73uvr2vuobf30': if flow['event_id'] == 'cq2batf73uvr2vuobf30':
cancel_flow = 1 cancel_flow = 1
elif flow['event_id'] == 'cq1ssgf73uvh93lop2mg': elif flow['event_id'] == 'cq1ssgf73uvh93lop2mg':
return_flow = 1 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, '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) 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)
api1: api1:
title: 检查列表文章数量 title: 检查列表文章数量
url: /api/v1/helpcenter/buser/GetFaqList?v=${v} url: /api/v1/helpcenter/buser/GetFaqList?shopId=${shopId}&v=${v}
method: get method: get
before_sql: FAQ/article_list_select.py before_sql: FAQ/article_list_select.py
expected: expected:
- eq: {"$.code": 0} - eq: {"$.code": 0}
- exec: {"code" : "assert len(res.json()['data']['articleList']) == ${all_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}"} # - exec: {"code" : "assert len([article for article in res.json()['data']['articleList'] if article['shopId'] == ${shopId}]) == ${shop_article_num}"}
api2: api2:
title: 检查文章信息 title: 检查文章信息
url: /api/v1/helpcenter/buser/GetFaqList?v=${v} url: /api/v1/helpcenter/buser/GetFaqList?shopId=${shopId}&v=${v}
method: get method: get
expected: expected:
- eq: {"$.code": 0} - eq: {"$.code": 0}
...@@ -45,7 +45,7 @@ api4: ...@@ -45,7 +45,7 @@ api4:
api5: api5:
title: 检查文章信息 title: 检查文章信息
url: /api/v1/helpcenter/buser/GetFaqList?v=${v} url: /api/v1/helpcenter/buser/GetFaqList?shopId=${shopId}&v=${v}
method: get method: get
expected: expected:
- eq: { "$.code": 0} - eq: { "$.code": 0}
...@@ -87,7 +87,7 @@ api9: ...@@ -87,7 +87,7 @@ api9:
api10: api10:
title: 检查文章信息 title: 检查文章信息
url: /api/v1/helpcenter/buser/GetFaqList?v=${v} url: /api/v1/helpcenter/buser/GetFaqList?shopId=${shopId}&v=${v}
method: get method: get
expected: expected:
- eq: { "$.code": 0} - eq: { "$.code": 0}
...@@ -140,7 +140,7 @@ api15: ...@@ -140,7 +140,7 @@ api15:
api16: api16:
title: 检查文章信息 title: 检查文章信息
url: /api/v1/helpcenter/buser/GetFaqList?v=${v} url: /api/v1/helpcenter/buser/GetFaqList?shopId=${shopId}&v=${v}
method: get method: get
expected: expected:
- eq: {"$.code": 0} - eq: {"$.code": 0}
......
...@@ -19,7 +19,7 @@ api2: ...@@ -19,7 +19,7 @@ api2:
api3: api3:
title: 检查是否新增分类、文章成功 title: 检查是否新增分类、文章成功
url: /api/v1/helpcenter/buser/GetFaqList?v=${v} url: /api/v1/helpcenter/buser/GetFaqList?shopId=${shopId}&v=${v}
method: get method: get
expected: expected:
- eq: {"$.code": 0} - eq: {"$.code": 0}
...@@ -74,7 +74,7 @@ api8: ...@@ -74,7 +74,7 @@ api8:
api9: api9:
title: 检查文章、分类是否更新成功 title: 检查文章、分类是否更新成功
url: /api/v1/helpcenter/buser/GetFaqList?v=${v} url: /api/v1/helpcenter/buser/GetFaqList?shopId=${shopId}&v=${v}
method: get method: get
expected: expected:
- eq: {"$.code": 0} - eq: {"$.code": 0}
...@@ -106,7 +106,7 @@ api11: ...@@ -106,7 +106,7 @@ api11:
api12: api12:
title: 检查是否删除成功 title: 检查是否删除成功
url: /api/v1/helpcenter/buser/GetFaqList?v=${v} url: /api/v1/helpcenter/buser/GetFaqList?shopId=${shopId}&v=${v}
method: get method: get
expected: expected:
- eq: {"$.code": 0} - eq: {"$.code": 0}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment