Commit 01f3c9e8 authored by liguangyu06's avatar liguangyu06
Browse files

1、优化用例

2、补充用例场景
parent c73d3f69
...@@ -3,7 +3,7 @@ __author__ = "liguangyu" ...@@ -3,7 +3,7 @@ __author__ = "liguangyu"
""" """
case_tag:cmdc_api,cmdc需求单创建(快速下单),2252,2252-3,sit,bs case_tag:cmdc_api,cmdc需求单创建(快速下单),2252,2252-3,sit,bs
主数据平台:多彩商城获取需求单创建接口 主数据平台:多彩商城需求单创建接口
""" """
from common.common_func import commonFuc from common.common_func import commonFuc
......
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc多彩商城需求单草稿创建,2252,2252-3,sit,bs
主数据平台:多彩商城需求单草稿订单创建(快速下单)接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多彩商城登录.多彩商城登录 import CmdcMaiiLogin
import requests
import json
module = "cmdc_demand_create_pc"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
# 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
request_body = commonFuc().get_business_data(module, "payload2")
"""
场景:通过快速下单入口提交创建需求单草稿
用例名称:通过快速下单入口提交创建需求单草稿
输出:{"success":true,"code":"200","message":"OK"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict2")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
...@@ -13,20 +13,18 @@ import json ...@@ -13,20 +13,18 @@ import json
module = "cmdc_demand_creation" module = "cmdc_demand_creation"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
print(url)
# 获取登录所需账号密码 # 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username") username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password") password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token # 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token() cmdc_access_token = CmdcDoLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token) headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
request_body = commonFuc().get_business_data(module, "payload1") request_body = commonFuc().get_business_data(module, "payload2")
""" """
场景:需求草稿订单的创建 场景:需求草稿订单的创建
用例名称:需求草稿订单的创建 用例名称:需求草稿订单的创建
输出:{"success":true,"code":"200","message":"ok","data":null,"freshToken":null} 输出:{"success":true,"code":"200","message":"OK"}
""" """
# 发送请求 # 发送请求
...@@ -34,7 +32,7 @@ result = requests.post(url, json=request_body, headers=headers) ...@@ -34,7 +32,7 @@ result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content) result = json.loads(result.content)
print(result) print(result)
# 获取预期结果 # 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict1") check_dict = commonFuc().get_business_data(module, "checkDict2")
print(check_dict) print(check_dict)
# 断言实际结果中是否包含预期结果的内容 # 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result) commonFuc().check_result(check_dict, result)
...@@ -20,7 +20,14 @@ password = commonFuc().get_business_data(module, "password") ...@@ -20,7 +20,14 @@ password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token # 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token() cmdc_access_token = CmdcDoLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers2", cmdc_access_token) headers = commonFuc().get_business_data(module, "json_headers2", cmdc_access_token)
# 第二步,获取需求单列表
# 第二步进行需求单草稿订单的创建
url2 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
request_body2 = commonFuc().get_business_data(module, "payload200")
# 发送请求
result2 = requests.post(url2, json=request_body2, headers=headers)
# 第三步,获取需求单列表
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1") url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload20") request_body = commonFuc().get_business_data(module, "payload20")
# 发送请求 # 发送请求
...@@ -29,13 +36,13 @@ result = json.loads(result.content) ...@@ -29,13 +36,13 @@ result = json.loads(result.content)
# 获取demandId # 获取demandId
demand_id = result["data"]["list"][0]["demandId"] demand_id = result["data"]["list"][0]["demandId"]
# 第步,获取到demandId进行需求单删除操作 # 第步,获取到demandId进行需求单删除操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
request_body = commonFuc().get_business_data(module, "payload2", demand_id) request_body = commonFuc().get_business_data(module, "payload2", demand_id)
# 发送请求 # 发送请求
result = requests.get(url, params=request_body, headers=headers) result = requests.get(url, params=request_body, headers=headers)
# 第步,获取到demandId进行需求单重复删除操作 # 第步,获取到demandId进行需求单重复删除操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
request_body = commonFuc().get_business_data(module, "payload3", demand_id) request_body = commonFuc().get_business_data(module, "payload3", demand_id)
......
...@@ -21,7 +21,13 @@ password = commonFuc().get_business_data(module, "password") ...@@ -21,7 +21,13 @@ password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token # 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token() cmdc_access_token = CmdcDoLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers2", cmdc_access_token) headers = commonFuc().get_business_data(module, "json_headers2", cmdc_access_token)
# 第二步,获取需求单列表
# 第二步进行需求单草稿订单的创建
url2 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
request_body2 = commonFuc().get_business_data(module, "payload200")
# 发送请求
result2 = requests.post(url2, json=request_body2, headers=headers)
# 第三步,获取需求单列表
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1") url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload20") request_body = commonFuc().get_business_data(module, "payload20")
# 发送请求 # 发送请求
...@@ -29,7 +35,8 @@ result = requests.post(url1, json=request_body, headers=headers) ...@@ -29,7 +35,8 @@ result = requests.post(url1, json=request_body, headers=headers)
result = json.loads(result.content) result = json.loads(result.content)
# 获取demandId # 获取demandId
demand_id = result["data"]["list"][0]["demandId"] demand_id = result["data"]["list"][0]["demandId"]
# 第三步,获取到demandId进行需求单删除操作
# 第四步,获取到demandId进行需求单删除操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
request_body = commonFuc().get_business_data(module, "payload2", demand_id) request_body = commonFuc().get_business_data(module, "payload2", demand_id)
...@@ -37,6 +44,7 @@ request_body = commonFuc().get_business_data(module, "payload2", demand_id) ...@@ -37,6 +44,7 @@ request_body = commonFuc().get_business_data(module, "payload2", demand_id)
场景:需求草稿订单可正常删除,删除后不再显示在需求列表中 场景:需求草稿订单可正常删除,删除后不再显示在需求列表中
用例名称:需求草稿订单删除功能验证 用例名称:需求草稿订单删除功能验证
输出:{"success":true,"code":"200","message":"OK","data":null} 输出:{"success":true,"code":"200","message":"OK","data":null}
备注:草稿订单一经删除,数据库也是直接物理删除
""" """
# 发送请求 # 发送请求
result = requests.get(url, params=request_body, headers=headers) result = requests.get(url, params=request_body, headers=headers)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Supports Markdown
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