Commit 6f368e70 authored by 刘琴's avatar 刘琴

编辑线索(图片数量和格式,必填项)

parent 4ca15137
......@@ -19,11 +19,13 @@
<select />
</component>
<component name="ChangeListManager">
<list default="true" id="54f4d37d-1724-4813-a1e2-24e200088c5f" name="Default Changelist" comment="编辑线索">
<list default="true" id="54f4d37d-1724-4813-a1e2-24e200088c5f" name="Default Changelist" comment="编辑线索(图片数量和格式,必填项)">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/common/common_config.py" beforeDir="false" afterPath="$PROJECT_DIR$/common/common_config.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/run.py" beforeDir="false" afterPath="$PROJECT_DIR$/run.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/defalut_account.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/defalut_account.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/service_crm_liuqin/case_data_handler_liuqin/myNewClue_handler.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/service_crm_liuqin/case_data_handler_liuqin/myNewClue_handler.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/service_crm_liuqin/common_liuqin/helpler.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/service_crm_liuqin/common_liuqin/helpler.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/service_crm_liuqin/testcase_clue/test_my_new_clue.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/service_crm_liuqin/testcase_clue/test_my_new_clue.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
......@@ -140,7 +142,7 @@
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="helpler" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<configuration name="myNewClue_handler" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="jk_interface_test" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
......@@ -148,11 +150,11 @@
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/script/ji_yun_ying_pc/service_crm_liuqin/common_liuqin" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/script/ji_yun_ying_pc/service_crm_liuqin/case_data_handler_liuqin" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="E:\interface\jk_interface_test\script\ji_yun_ying_pc\service_crm_liuqin\common_liuqin\helpler.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/script/ji_yun_ying_pc/service_crm_liuqin/case_data_handler_liuqin/myNewClue_handler.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
......@@ -201,18 +203,18 @@
</configuration>
<list>
<item itemvalue="Python.run" />
<item itemvalue="Python.helpler" />
<item itemvalue="Python.helpler (1)" />
<item itemvalue="Python.conftest" />
<item itemvalue="Python tests.pytest in test_my_new_clue.py" />
<item itemvalue="Python.myNewClue_handler" />
</list>
<recent_temporary>
<list>
<item itemvalue="Python.run" />
<item itemvalue="Python.conftest" />
<item itemvalue="Python.myNewClue_handler" />
<item itemvalue="Python.helpler (1)" />
<item itemvalue="Python.conftest" />
<item itemvalue="Python tests.pytest in test_my_new_clue.py" />
<item itemvalue="Python.helpler" />
</list>
</recent_temporary>
</component>
......@@ -279,7 +281,14 @@
<option name="project" value="LOCAL" />
<updated>1619777539691</updated>
</task>
<option name="localTasksCounter" value="8" />
<task id="LOCAL-00008" summary="编辑线索(图片数量和格式,必填项)">
<created>1620266280390</created>
<option name="number" value="00008" />
<option name="presentableId" value="LOCAL-00008" />
<option name="project" value="LOCAL" />
<updated>1620266280390</updated>
</task>
<option name="localTasksCounter" value="9" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
......@@ -305,7 +314,8 @@
<MESSAGE value="修改响应" />
<MESSAGE value="查询所有线索+新增线索(必填项)+查询单个线索" />
<MESSAGE value="编辑线索" />
<option name="LAST_COMMIT_MESSAGE" value="编辑线索" />
<MESSAGE value="编辑线索(图片数量和格式,必填项)" />
<option name="LAST_COMMIT_MESSAGE" value="编辑线索(图片数量和格式,必填项)" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
......@@ -315,6 +325,11 @@
<line>1</line>
<option name="timeStamp" value="1" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/common/connect_db.py</url>
<line>1</line>
<option name="timeStamp" value="2" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
......
common_config = {
"host": "http://172.10.62.94",
# "host": "http://172.10.62.94",
"host": "http://192.168.32.31",
"db_config": {
'database': 'edu-admin',
"user": 'read_user',
"password": 'c5JJUqmtTeaSaOTN2gs7',
"host": '132.232.15.12',
"user": 'dev',
# "user": 'read_user',
# "password": 'c5JJUqmtTeaSaOTN2gs7',
"password": 'mko0PL<.;?',
# "host": '132.232.15.12',
"host": '192.168.32.31',
"port": 5432
},
"mongo_db_config": {
......
......@@ -3,11 +3,11 @@ import os
if __name__ == '__main__':
run_config = [
"-s", r"script\ji_yun_ying_pc\service_crm_liuqin\testcase_clue\test_my_new_clue.py::TestMyNewClue::test_edit_my_new_clue_with_wrong_file",
"-s", r"script\ji_yun_ying_pc\service_crm_liuqin\testcase_clue\test_my_new_clue.py::TestMyNewClue::test_query_transformed_clue_with_sourceId",
"--clean-alluredir",
"--alluredir", "./report/xml",
# "--host", "http://192.168.32.31",
"--host", "https://yf1.jkwljy.com",
"--host", "http://192.168.32.31",
# "--host", "https://yf1.jkwljy.com",
"--account", "A",
"--db", "36"
]
......
......@@ -4,8 +4,8 @@ accounts = {
"A": {
# 极运营默认账号
"jyy_account": {
"account": "18224499511",
# "account": "15360956010",
# "account": "18224499511",
"account": "15360956010",
"password": "88888888"
},
# 极运营app默认账号
......
import random
from script.ji_yun_ying_pc.service_crm_liuqin.common_liuqin.helpler import get_mobile, get_time, get_tomorrow_datetime
class Add_My_New_Clue():
intentionLevel_list = ["S", "A", "B", "C"]
sourceId_list = [100, 101, 102, 103, 104]
publicGrade_list = ['零年级','一年级','二年级','三年级','四年级','五年级','六年级','七年级','八年级','九年级','高一','高二','高三']
def __init__(self,contactInfo=get_mobile(),studentName="lq{}".format(get_time()),belong="PERSON",contactType="PHONE",studentSex="NONE",
collectPerson="黄强测试人员", inChargeEmployeeId=8223,createSchoolAreaId=3015,introduceStudentNo=None,otherRemark=None,
homeProvinceId=None,homeProvince=None,homeCityId=None,homeCity=None,homeDistrictId=None,
homeDistrict=None,homeCountyId=None,homeCounty=None,homeAddress=None,schoolId=None,schoolName=None,
publicClass=None,publicTeacher=None,publicGrade=None,birthday=None,testPaperUrls=None,
score=None,sourceId=101,intentionLevel="B",introduceStudentId=None,introduceStudentName=None,
publicClass=None,publicTeacher=None,publicGrade=random.sample(publicGrade_list,1)[0],birthday=None,testPaperUrls=None,
score=None,sourceId=random.sample(sourceId_list,1)[0],intentionLevel=random.sample(intentionLevel_list,1)[0],introduceStudentId=None,introduceStudentName=None,
remark=None,classRank=None,gradeRank=None,recentScore=None,parentsHope=None,
studyHabit=None,city=510100,schoolProvinceName="四川省",schoolProvinceId=510000,
schoolCityId=510000,schoolCityName="成都"
......@@ -103,16 +107,19 @@ class Add_My_New_Clue():
"""
class Add_My_New_All_Clue():
intentionLevel_list = ["S", "A", "B", "C"]
sourceId_list = [100, 101, 102, 103, 104]
publicGrade_list = ['零年级','一年级','二年级','三年级','四年级','五年级','六年级','七年级','八年级','九年级','高一','高二','高三']
def __init__(self, contactInfo=get_mobile(), studentName="lq全{}".format(get_time()), belong="PERSON",
contactType="WECHAT", secondContactType="TEL",secondContactInfo="028-85568842",studentSex="F",
collectPerson="黄强测试人员", inChargeEmployeeId=8223, createSchoolAreaId=3015,
introduceStudentNo=218584, otherRemark=None,
homeProvinceId=510000, homeProvince="四川省", homeCityId=510600, homeCity="德阳市", homeDistrictId=510623,
homeDistrict="中江县", homeCountyId=510623101, homeCounty="南华镇", homeAddress="测试地址", schoolId=13187,
homeDistrict="中江县", homeCountyId=510623101, homeCounty="南华镇", homeAddress="测试地址", schoolId=random.sample(sourceId_list,1)[0],
schoolName="华阳中学",
publicClass="测试班级", publicTeacher="测试老师", publicGrade="三年级", birthday="2013-05-02",
publicClass="测试班级", publicTeacher="测试老师", publicGrade=random.sample(publicGrade_list,1)[0], birthday="2013-05-02",
testPaperUrls="https://test-1257124244.cos.ap-chengdu.myqcloud.com/img/63a0757824c856b31312f9d8a0c60c52.jpeg",
score=999, sourceId=102, intentionLevel="C", introduceStudentId=10170940,
score=999, sourceId=102, intentionLevel=random.sample(intentionLevel_list,1)[0], introduceStudentId=10170940,
introduceStudentName="lq测试用",
remark="测试新增线索所有项", classRank="12", gradeRank="23", recentScore="111", parentsHope="222",
studyHabit="333", city=510100, schoolProvinceName="四川省", schoolProvinceId=510000,
......@@ -315,4 +322,4 @@ class Add_My_New_All_Clue():
"""
if __name__ == '__main__':
print(type(Add_My_New_Clue().add_clue_data))
print(Add_My_New_Clue().add_clue_data.get('intentionLevel'))
......@@ -13,15 +13,57 @@ def get_mobile():
def get_time():
# 获取当前时间
ts =str(int(time.time()))
return ts
def get_tomorrow_datetime():
# 获取明天日期
temp_date = datetime.datetime.now() # 获取当前时间 年月日时分秒
date1 = (temp_date + datetime.timedelta(days=+1)).strftime("%Y-%m-%d %H:%M:%S")
return date1
def get_today():
# 获取今天
today = time.strftime("%Y-%m-%d", time.localtime())
return today
def get_this_week():
# 获取当前日期星期
now = datetime.datetime.now()
this_week_start = now - datetime.timedelta(days=now.weekday())
this_week_end = now + datetime.timedelta(days=6 - now.weekday())
week_start = this_week_start.strftime("%Y-%m-%d")
week_end = this_week_end.strftime("%Y-%m-%d")
return {'week_start':week_start,'week_end':week_end}
def get_this_month():
# 获取当前日期月
now = datetime.datetime.now()
this_month_start = datetime.datetime(now.year,now.month,1)
this_month_end = datetime.datetime(now.year,now.month+1,1) - datetime.timedelta(days=1) + datetime.timedelta(hours=23, minutes=59, seconds=59)
month_start = this_month_start.strftime("%Y-%m-%d")
month_end = this_month_end.strftime("%Y-%m-%d")
return {'month_start':month_start,'month_end':month_end}
def time_transform_day(change_time):
# createTime: 1620387156 转换为2021-05-07 (时间戳转换为日期格式)
day = time.localtime(change_time)
day = time.strftime("%Y-%m-%d", day)
return day
def day_transform_time(change_time):
# createTimeStr: "2021-05-07 19:32:36" 转换为 2021-05-07 (格式转换为日期格式)
timeStruct = time.strptime(change_time, "%Y-%m-%d %H:%M:%S")
timeStruct = time.strftime("%Y-%m-%d", timeStruct)
return timeStruct
if __name__ == '__main__':
print(get_mobile())
print(get_time())
print(get_tomorrow_datetime())
\ No newline at end of file
# print(get_mobile())
# print(get_time())
# print(get_tomorrow_datetime())
# print(get_this_week())
# print(get_this_month())
print(time_transform_day(1620387156))
print(day_transform_time("2021-05-07 19:32:36"))
import json
import random
import time
import pytest
import requests
from jsonpath import jsonpath
from pytest_assume.plugin import assume
from init_base_api import query_sql
from script.base_api import clue_manualInputAdd_post, clue_queryAll_post, clue_manualInputEdit_post, clue_query_id_get, \
employees_info_get
from common.connect_db import OperationDb
from script.base_api import clue_manualInputAdd_post, clue_queryAll_post, clue_manualInputEdit_post, \
clue_query_id_get, employees_info_get
from script.default_header import jyy_header
from script.ji_yun_ying_pc.service_crm_liuqin.case_data_handler_liuqin.myNewClue_handler import Add_My_New_Clue, \
Add_My_New_All_Clue
# def jyy_login():
# url = 'https://yf1.jkwljy.com/service-user/auth/employee'
# json_data = {"type":"employee","identityType":1,"ip":"0.0.0.0","account":"18224499511","password":"88888888","assistant":False}
# res = requests.post(url,json=json_data)
# res = res.json()
# token = jsonpath(res,'$..token')[0]
# return token
#
#
from script.ji_yun_ying_pc.service_crm_liuqin.common_liuqin.helpler import get_time, get_mobile
from script.ji_yun_ying_pc.service_crm_liuqin.conftest import query_all_following_clues
from script.ji_yun_ying_pc.service_crm_liuqin.common_liuqin.helpler import get_time, get_mobile, get_today, \
day_transform_time
class TestMyNewClue():
......@@ -30,132 +18,272 @@ class TestMyNewClue():
测试“我的新线索”
"""
def test_add_new_clue_success(self):
def test_add_new_clue_success_with_phone(self):
# 必填项,新增线索成功
json_data = Add_My_New_Clue().add_clue_data
clue_name=json_data['studentName']
clue_contactInfo=json_data['contactInfo']
res = clue_manualInputAdd_post(body=json_data,header=jyy_header)
query_phone={"belong":"PERSON","status":"FOLLOWING","pageNum":1,"pageSize":10,"studentName":clue_contactInfo,"orderType":"desc","orderField":"id","schoolAreas":[3015]}
res_query_data = clue_queryAll_post(body=query_phone,header=jyy_header)
res_contactInfo=jsonpath(res_query_data,'$..contactInfo')[0]
clue_contactInfo = json_data['contactInfo']
res = clue_manualInputAdd_post(body=json_data, header=jyy_header)
query_phone = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10,
"studentName": clue_contactInfo, "orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res_query_data = clue_queryAll_post(body=query_phone, header=jyy_header)
res_contactInfo = jsonpath(res_query_data, '$..contactInfo')[0]
with assume:assert res['code']==0
with assume:assert res['msg']=='成功'
with assume:assert res_contactInfo==clue_contactInfo
with assume: assert res['code'] == 0
with assume: assert res['msg'] == '成功'
with assume: assert res_contactInfo == clue_contactInfo
def test_add_new_clue_all_success(self):
# 所有项,新增线索成功
json_data = Add_My_New_All_Clue().add_clue_data
clue_name=json_data['studentName']
clue_contactInfo=json_data['contactInfo']
secondContactInfo=json_data['secondContactInfo']
print('这是第二个联系方式:---》',secondContactInfo)
res = clue_manualInputAdd_post(body=json_data,header=jyy_header)
query_phone={"belong":"PERSON","status":"FOLLOWING","pageNum":1,"pageSize":10,"studentName":clue_contactInfo,"orderType":"desc","orderField":"id","schoolAreas":[3015]}
res_query_data = clue_queryAll_post(body=query_phone,header=jyy_header)
print('返回的值---》',res_query_data)
res_studentName=jsonpath(res_query_data,'$..studentName')[0]
res_contactInfo=jsonpath(res_query_data,'$..contactInfo')[0]
# TODO:第二个联系方式没有返回!!!
res_secondContactInfo = jsonpath(res_query_data,'$..secondContactInfo')[0]
clue_name = json_data['studentName']
clue_contactInfo = json_data['contactInfo']
secondContactInfo = json_data['secondContactInfo']
print('这是第二个联系方式:---》', secondContactInfo)
res = clue_manualInputAdd_post(body=json_data, header=jyy_header)
query_phone = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10,
"studentName": clue_contactInfo, "orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res_query_data = clue_queryAll_post(body=query_phone, header=jyy_header)
print('返回的值---》', res_query_data)
res_studentName = jsonpath(res_query_data, '$..studentName')[0]
res_contactInfo = jsonpath(res_query_data, '$..contactInfo')[0]
# TODO:第二个联系方式没有返回!!!
res_secondContactInfo = jsonpath(res_query_data, '$..secondContactInfo')[0]
with assume:assert res['code']==0
with assume:assert res['msg']=='成功'
with assume:assert res_studentName==clue_name
with assume:assert res_contactInfo==clue_contactInfo
with assume: assert res['code'] == 0
with assume: assert res['msg'] == '成功'
with assume: assert res_studentName == clue_name
with assume: assert res_contactInfo == clue_contactInfo
# with assume:assert res_secondContactInfo==secondContactInfo
def test_add_new_clue_success_with_wechat(self):
# 必填项-微信联系方式,新增线索成功
json_data = Add_My_New_Clue(contactType="WECHAT").add_clue_data
clue_name = json_data['studentName']
clue_contactInfo = json_data['contactInfo']
clue_contactType = json_data['contactType']
res = clue_manualInputAdd_post(body=json_data, header=jyy_header)
query_phone = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10,
"studentName": clue_contactInfo, "orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res_query_data = clue_queryAll_post(body=query_phone, header=jyy_header)
res_contactInfo = jsonpath(res_query_data, '$..contactInfo')[0]
# TODO:查询列表,没有返回contactType字段,不能用这个字段断言!!!
# res_contactType=jsonpath(res_query_data,'$..contactType')[0]
with assume: assert res['code'] == 0
with assume: assert res['msg'] == '成功'
with assume: assert res_contactInfo == clue_contactInfo
def test_add_new_clue_success_with_tel(self):
# 必填项-座机联系方式,新增线索成功
json_data = Add_My_New_Clue(contactType="TEL", contactInfo="028-85568842").add_clue_data
clue_name = json_data['studentName']
clue_contactInfo = json_data['contactInfo']
res = clue_manualInputAdd_post(body=json_data, header=jyy_header)
query_phone = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10,
"studentName": clue_contactInfo, "orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res_query_data = clue_queryAll_post(body=query_phone, header=jyy_header)
print('查询后的值:', res_query_data)
res_contactInfo = jsonpath(res_query_data, '$..contactInfo')[0]
# TODO:查询列表,没有返回contactType字段,不能用这个字段断言!!!
# res_contactType=jsonpath(res_query_data,'$..contactType')[0]
with assume: assert res['code'] == 0
with assume: assert res['msg'] == '成功'
with assume: assert res_contactInfo == clue_contactInfo
@pytest.mark.usefixtures
def test_edit_new_clue_all_success(self,query_all_following_clues):
# 编辑所有项,保存成功
def test_edit_new_clue_no_change_success(self, query_all_following_clues):
# 不改变线索联系电话和姓名编辑,保存成功
# 查询第一条线索id
first_clue_id = query_all_following_clues['id']
params_data = {'clueId': first_clue_id}
res_clue = clue_query_id_get(params=params_data, header=jyy_header)
edit_data = res_clue['data']
studentId = jsonpath(edit_data,'$..studentId')[0]
primUserId = jsonpath(edit_data,'$..primUserId')[0]
secondUserId = jsonpath(edit_data,'$..secondUserId')[0]
studentNo = jsonpath(edit_data,'$..studentNo')[0]
# 编辑线索需要的data参数
edit_json_data = {"clueId":first_clue_id, "studentName":"lq修改所有项{}".format(get_time()), "studentSex":"F", "introduceStudentId":10576818,
"introduceStudentNo":624495, "introduceStudentName":"小王测试1", "collectPerson":"刘琴琴",
"intentionLevel":"S", "sourceId":111, "sourceName":"自然口碑", "remark":"测试修改所有项", "otherRemark":"lq",
"birthday":"2020-05-01", "publicClass":"修改班级", "publicTeacher":"修改老师", "publicGrade":"三年级",
"contactInfo":"18600000001", "contactType":"PHONE", "schoolName":"石鱼小学", "homeProvinceId":130000,
"homeProvince":"河北省", "homeCityId":130200, "homeCity":"唐山市", "homeDistrictId":130203,
"homeDistrict":"路北区", "homeCountyId":130203002, "homeCounty":"文化路街道", "homeAddress":"修改地址",
"testPaperUrls":"https://test-1257124244.cos.ap-chengdu.myqcloud.com/img/63a0757824c856b31312f9d8a0c60c52.jpeg",
"score":"100", "lastClueId":None, "nextClueId":None, "nextFollowTime":"2021-05-03 23:59:59",
"schoolId":13349, "schoolProvinceId":500000, "schoolProvinceName":"重庆", "schoolCityId":500100,
"schoolCityName":"重庆", "schoolAreaId":None, "schoolAreaName":None, "classRank":"111",
"gradeRank":"1111", "recentScore":"123", "studyHabit":"789", "parentsHope":"456", "city":500100,
"studentId":studentId, "primUserId":primUserId, "secondUserId":secondUserId, "areaId":None, "studentNo":studentNo,
"secondContactType":"WECHAT", "secondContactInfo":"123456", "createSchoolAreaId":3015,
"belongSchoolAreaId":3015,
"citys":[{"id": 510000, "name": "四川省", "parentId": None, "type": 10},
{"id": 510100, "name": "成都市", "parentId": 510000, "type": 20}],
"cityName":"四川省-成都市","id":first_clue_id, "belong":"PERSON"}
res = clue_manualInputEdit_post(body=edit_json_data,header=jyy_header)
print('编辑线索后的返回值',res)
res_contactInfo = jsonpath(res,'$..contactInfo')[0]
res_studentName = jsonpath(res,'$..studentName')[0]
res_introduceStudentId = jsonpath(res,'$..introduceStudentId')[0]
res_remark = jsonpath(res,'$..remark')[0]
res_studentId = jsonpath(res,'$..studentId')[0]
with assume:assert res['code']==0
with assume:assert res['msg']=='成功'
with assume:assert res_contactInfo==edit_json_data['contactInfo']
with assume:assert res_studentName==edit_json_data['studentName']
with assume:assert res_introduceStudentId==edit_json_data['introduceStudentId']
with assume:assert res_remark==edit_json_data['remark']
with assume:assert res_studentId==edit_json_data['studentId']
def test_add_clue_more_areaschool_failure (self):
print(edit_data)
# 用第一条线索的返回值,作为编辑线索的data
edit_data.pop('status')
edit_data.pop('statusTranslate')
edit_data['id'] = first_clue_id
res = clue_manualInputEdit_post(body=edit_data, header=jyy_header, default_assert=False)
print('编辑线索后的返回值', res)
res_contactInfo = jsonpath(res, '$..contactInfo')[0]
res_studentName = jsonpath(res, '$..studentName')[0]
with assume: assert res['code'] == 0
with assume: assert res['msg'] == '成功'
with assume: assert res_contactInfo == edit_data['contactInfo']
with assume: assert res_studentName == edit_data['studentName']
def test_add_clue_more_area_school_failure(self):
# 传入多个校区id,新增线索失败
json_data = Add_My_New_Clue().add_clue_data
json_data['createSchoolAreaId']=[2389,2398,3363,3015]
res = clue_manualInputAdd_post(body=json_data,header=jyy_header)
with assume:assert res['code']==100110001
json_data['createSchoolAreaId'] = [2389, 2398, 3363, 3015]
res = clue_manualInputAdd_post(body=json_data, header=jyy_header, default_assert=False)
with assume: assert res['code'] == 100110001
def test_add_clue_no_permission_failure (self):
def test_add_clue_no_permission_failure(self):
# 在没有权限的校区,新增线索失败
token = jyy_header['Authorization'].replace('Bearer ','')
print('去掉Bearer 的token',token)
params_data = {'token':token}
res_info = employees_info_get(params=params_data,header=jyy_header)
token = jyy_header['Authorization'].replace('Bearer ', '')
print('去掉Bearer 的token', token)
params_data = {'token': token}
res_info = employees_info_get(params=params_data, header=jyy_header)
permission_school = res_info['data']['schoolAreaId']
print('有权限的校区---》',permission_school)
print('有权限的校区---》', permission_school)
json_data = Add_My_New_Clue().add_clue_data
json_data['createSchoolAreaId']=[3345] # 测试小蓝鲸学校
json_data['createSchoolAreaId'] = [3345] # 测试小蓝鲸学校
if json_data['createSchoolAreaId'] not in permission_school:
res = clue_manualInputAdd_post(body=json_data,header=jyy_header,default_assert=False)
res = clue_manualInputAdd_post(body=json_data, header=jyy_header, default_assert=False)
else:
json_data['createSchoolAreaId'] = [1001]
res = clue_manualInputAdd_post(body=json_data,header=jyy_header,default_assert=False)
res = clue_manualInputAdd_post(body=json_data, header=jyy_header, default_assert=False)
with assume:
assert res['code'] == 100110001
def test_add_new_clue_failure_with_repeat_name_and_phone(self):
# 姓名和第一联系方式同时重复创建失败
first_json_data = Add_My_New_Clue().add_clue_data
clue_name = first_json_data['studentName']
clue_contactType = first_json_data['contactType']
clue_contactInfo = first_json_data['contactInfo']
first_res = clue_manualInputAdd_post(body=first_json_data, header=jyy_header)
time.sleep(3)
with assume:assert res['code']==100110001
second_json_data = Add_My_New_Clue(studentName=clue_name, contactType=clue_contactType,
contactInfo=clue_contactInfo).add_clue_data
res = clue_manualInputAdd_post(body=second_json_data, header=jyy_header, default_assert=False)
print('重复创建线索后的返回值:', res)
with assume: assert res['code'] == 100210006
with assume: assert res['msg'] == '该学生已存在,无法新建学员,请确认具体情况。'
def test_add_new_clue_failure_with_repeat_only_phone(self):
# 判重校验正确,不管联系方式类型(手机、座机、微信)只判断联系号码
first_json_data = Add_My_New_Clue(contactType="PHONE").add_clue_data
clue_name = first_json_data['studentName']
clue_contactType = first_json_data['contactType']
clue_contactInfo = first_json_data['contactInfo']
first_res = clue_manualInputAdd_post(body=first_json_data, header=jyy_header)
time.sleep(3)
second_json_data = Add_My_New_Clue(studentName=clue_name, contactType="WECHAT",
contactInfo=clue_contactInfo).add_clue_data
res = clue_manualInputAdd_post(body=second_json_data, header=jyy_header, default_assert=False)
print('重复创建线索后的返回值:', res)
with assume: assert res['code'] == 100210006
with assume: assert res['msg'] == '该学生已存在,无法新建学员,请确认具体情况。'
def test_add_new_clue_failure_with_same_phone(self):
# 线索本身第一联系方式与第二联方式一样
pho = get_mobile()
first_json_data = Add_My_New_All_Clue(contactInfo=pho, contactType="WECHAT", secondContactType="TEL",
secondContactInfo=pho).add_clue_data
res = clue_manualInputAdd_post(body=first_json_data, header=jyy_header, default_assert=False)
with assume: assert res['code'] == 100210006
with assume: assert res['msg'] == '新建学生出错!新增学生失败!错误信息:第一联系方式和第二联系方式不能相同'
@pytest.mark.usefixtures
def test_edit_my_new_clue(self,query_all_following_clues):
"""编辑线索,必填项"""
def test_edit_new_clue_failure_with_repeat_name_and_phone(self, query_all_following_clues):
"""编辑线索,姓名和第一联系方式同时重复"""
# 查询第一条线索id
first_clue_id = query_all_following_clues['id']
params_data = {'clueId': first_clue_id}
res_clue = clue_query_id_get(params=params_data, header=jyy_header)
edit_data = res_clue['data']
print(edit_data)
# 查询数据库,获取已存在的电话和姓名
query_pg_clue = OperationDb().query_sql(
'select student_name, contact_info from service_crm.clue_basic_info ORDER BY id desc LIMIT 2;')[1]
print('这是查询库的线索', query_pg_clue)
# 用第一条线索的返回值,作为编辑线索的data
edit_data.pop('status')
edit_data.pop('statusTranslate')
edit_data['studentName'] = query_pg_clue[0]
edit_data['contactInfo'] = query_pg_clue[1]
edit_data['cityName'] = "四川省-成都市"
edit_data['id'] = first_clue_id
edit_data['belong'] = "PERSON"
print('编辑传入的edit_data:', edit_data)
res = clue_manualInputEdit_post(body=edit_data, header=jyy_header, default_assert=False)
print('编辑线索后的返回值', res)
with assume: assert res['code'] == 100210006
with assume: assert res['msg'] == '已存在姓名和联系方式相同的线索,不允许修改'
@pytest.mark.usefixtures
def test_edit_new_clue_failure_with_repeat_name_and_second_phone(self, query_all_following_clues):
"""编辑线索,姓名和第二联系方式同时重复"""
# 查询第一条线索id
first_clue_id = query_all_following_clues['id']
params_data = {'clueId': first_clue_id}
res_clue = clue_query_id_get(params=params_data, header=jyy_header)
edit_data = res_clue['data']
print(edit_data)
# 查询数据库,获取已存在的电话和姓名
query_pg_clue = OperationDb().query_sql(
"select student_name, second_contact_type,second_contact_info from service_crm.clue_basic_info WHERE second_contact_info is not NULL and second_contact_info != '' LIMIT 1;")[
0]
print('这是查询库的线索', query_pg_clue)
# 用第一条线索的返回值,作为编辑线索的data
edit_data.pop('status')
edit_data.pop('statusTranslate')
edit_data['studentName'] = query_pg_clue[0]
edit_data['contactType'] = query_pg_clue[1]
edit_data['contactInfo'] = query_pg_clue[2]
edit_data['cityName'] = "四川省-成都市"
edit_data['id'] = first_clue_id
edit_data['belong'] = "PERSON"
print('编辑传入的edit_data:', edit_data)
res = clue_manualInputEdit_post(body=edit_data, header=jyy_header, default_assert=False)
print('编辑线索后的返回值', res)
with assume: assert res['code'] == 100210006
with assume: assert res['msg'] == '已存在姓名和联系方式相同的线索,不允许修改'
def test_add_new_clue_failure_with_repeat_name_and_second_phone(self):
# 添加,姓名和第一联系方式同时重复创建失败
# contactInfo=get_mobile(), studentName="lq全{}".format(get_time()), belong="PERSON",
# contactType="WECHAT", secondContactType="TEL",secondContactInfo="028-85568842"
first_json_data = Add_My_New_All_Clue().add_clue_data
clue_name = first_json_data['studentName']
clue_contactType = first_json_data['contactType']
clue_contactInfo = first_json_data['contactInfo']
clue_secondContactType = first_json_data['secondContactType']
clue_secondContactInfo = first_json_data['secondContactInfo']
first_res = clue_manualInputAdd_post(body=first_json_data, header=jyy_header)
time.sleep(3)
second_json_data = Add_My_New_All_Clue(studentName=clue_name, contactType=clue_contactType,
contactInfo=clue_contactInfo,
secondContactType=clue_secondContactType,
secondContactInfo=clue_secondContactInfo
).add_clue_data
res = clue_manualInputAdd_post(body=second_json_data, header=jyy_header, default_assert=False)
print('重复创建线索后的返回值:', res)
with assume: assert res['code'] == 100210006
with assume: assert res['msg'] == '该学生已存在,无法新建学员,请确认具体情况。'
@pytest.mark.usefixtures
def test_edit_new_clue_failure_with_repeat_name_and_first_second_phone(self, query_all_following_clues):
"""编辑线索,姓名和第一、第二联系方式同时重复"""
# 查询第一条线索id
first_clue_id = query_all_following_clues['id']
params_data = {'clueId': first_clue_id}
......@@ -163,28 +291,79 @@ class TestMyNewClue():
edit_data = res_clue['data']
print(edit_data)
# 查询数据库,获取已存在的电话和姓名
query_pg_clue = OperationDb().query_sql(
"select student_name,contact_type,contact_info,second_contact_type,second_contact_info from service_crm.clue_basic_info WHERE second_contact_info is not NULL and second_contact_info != '' LIMIT 1;")[
0]
print('这是查询库的线索', query_pg_clue)
# 用第一条线索的返回值,作为编辑线索的data
edit_data.pop('status')
edit_data.pop('statusTranslate')
edit_data['studentName']='liuqin修改{}'.format(get_time())
edit_data['contactInfo']=get_mobile()
edit_data['studentName'] = query_pg_clue[0]
edit_data['contactType'] = query_pg_clue[1]
edit_data['contactInfo'] = query_pg_clue[2]
edit_data['secondContactType'] = query_pg_clue[3]
edit_data['secondContactInfo'] = query_pg_clue[4]
edit_data['cityName'] = "四川省-成都市"
edit_data['id'] = first_clue_id
edit_data['belong'] = "PERSON"
print('编辑传入的edit_data:',edit_data)
print('编辑传入的edit_data:', edit_data)
res = clue_manualInputEdit_post(body=edit_data, header=jyy_header, default_assert=False)
print('编辑线索后的返回值', res)
with assume: assert res['code'] == 100210006
with assume: assert res['msg'] == '已存在姓名和联系方式相同的线索,不允许修改'
res = clue_manualInputEdit_post(body=edit_data,header=jyy_header)
print('编辑线索后的返回值',res)
res_contactInfo = jsonpath(res,'$..contactInfo')[0]
res_studentName = jsonpath(res,'$..studentName')[0]
with assume:assert res['code']==0
with assume:assert res['msg']=='成功'
with assume:assert res_contactInfo==edit_data['contactInfo']
with assume:assert res_studentName==edit_data['studentName']
def test_add_new_clue_failure_with_repeat_in_other_school(self):
# 跨校区重复,创建线索
first_json_data = Add_My_New_Clue().add_clue_data
clue_name = first_json_data['studentName']
clue_contactType = first_json_data['contactType']
clue_contactInfo = first_json_data['contactInfo']
first_res = clue_manualInputAdd_post(body=first_json_data, header=jyy_header)
time.sleep(3)
second_json_data = Add_My_New_Clue(studentName=clue_name, contactType=clue_contactType,
contactInfo=clue_contactInfo, createSchoolAreaId=2383).add_clue_data
res = clue_manualInputAdd_post(body=second_json_data, header=jyy_header, default_assert=False)
print('重复创建线索后的返回值:', res)
with assume: assert res['code'] == 100210006
with assume: assert res['msg'] == '该学生已存在,无法新建学员,请确认具体情况。'
@pytest.mark.usefixtures
def test_edit_my_new_clue_with_more_file(self,query_all_following_clues):
def test_edit_my_new_clue(self, query_all_following_clues):
"""编辑线索,必填项"""
# 查询第一条线索id
first_clue_id = query_all_following_clues['id']
params_data = {'clueId': first_clue_id}
res_clue = clue_query_id_get(params=params_data, header=jyy_header)
edit_data = res_clue['data']
print(edit_data)
# 用第一条线索的返回值,作为编辑线索的data
edit_data.pop('status')
edit_data.pop('statusTranslate')
edit_data['studentName'] = 'liuqin修改{}'.format(get_time())
edit_data['contactInfo'] = get_mobile()
edit_data['cityName'] = "四川省-成都市"
edit_data['id'] = first_clue_id
edit_data['belong'] = "PERSON"
print('编辑传入的edit_data:', edit_data)
res = clue_manualInputEdit_post(body=edit_data, header=jyy_header)
print('编辑线索后的返回值', res)
res_contactInfo = jsonpath(res, '$..contactInfo')[0]
res_studentName = jsonpath(res, '$..studentName')[0]
with assume: assert res['code'] == 0
with assume: assert res['msg'] == '成功'
with assume: assert res_contactInfo == edit_data['contactInfo']
with assume: assert res_studentName == edit_data['studentName']
@pytest.mark.usefixtures
def test_edit_my_new_clue_with_more_file(self, query_all_following_clues):
"""编辑线索,上传多个文件"""
# 查询第一条线索id
first_clue_id = query_all_following_clues['id']
......@@ -196,27 +375,28 @@ class TestMyNewClue():
# 用第一条线索的返回值,作为编辑线索的data
edit_data.pop('status')
edit_data.pop('statusTranslate')
edit_data['studentName']='lq多附件{}'.format(get_time())
edit_data['contactInfo']=get_mobile()
edit_data['studentName'] = 'lq多附件{}'.format(get_time())
edit_data['contactInfo'] = get_mobile()
edit_data['cityName'] = "四川省-成都市"
edit_data['id'] = first_clue_id
edit_data['belong'] = "PERSON"
edit_data['testPaperUrls'] = "https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/63a0757824c856b31312f9d8a0c60c52.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/4556a3e12fdc1b4e5beb33e4743e7c48.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/14dc4d32bec5f1ab41c657dea8fd225d.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/727cd885cac14da50184628bbd86738b.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/5275ba540e26e3606cd53c4cd618cdb9.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/3f9d98159775a1bf9aca2c7a0bf25a27.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/e3243c2c422c5a8c88b17c015e9657ba.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/b716298e7276bbc3a9401379ab1251b2.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/499abd25a5ae9b28cab28f26c17d08e7.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/a473f799b65cd31bed4937a79615902e.jpeg"
print('编辑传入的edit_data:',edit_data)
res = clue_manualInputEdit_post(body=edit_data,header=jyy_header)
print('编辑线索后的返回值',res)
res_contactInfo = jsonpath(res,'$..contactInfo')[0]
res_studentName = jsonpath(res,'$..studentName')[0]
res_testPaperUrls = jsonpath(res,'$..testPaperUrls')[0]
with assume:assert res['code']==0
with assume:assert res['msg']=='成功'
with assume:assert res_contactInfo==edit_data['contactInfo']
with assume:assert res_studentName==edit_data['studentName']
with assume:assert res_testPaperUrls==edit_data['testPaperUrls']
edit_data[
'testPaperUrls'] = "https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/63a0757824c856b31312f9d8a0c60c52.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/4556a3e12fdc1b4e5beb33e4743e7c48.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/14dc4d32bec5f1ab41c657dea8fd225d.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/727cd885cac14da50184628bbd86738b.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/5275ba540e26e3606cd53c4cd618cdb9.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/3f9d98159775a1bf9aca2c7a0bf25a27.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/e3243c2c422c5a8c88b17c015e9657ba.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/b716298e7276bbc3a9401379ab1251b2.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/499abd25a5ae9b28cab28f26c17d08e7.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/a473f799b65cd31bed4937a79615902e.jpeg"
print('编辑传入的edit_data:', edit_data)
res = clue_manualInputEdit_post(body=edit_data, header=jyy_header)
print('编辑线索后的返回值', res)
res_contactInfo = jsonpath(res, '$..contactInfo')[0]
res_studentName = jsonpath(res, '$..studentName')[0]
res_testPaperUrls = jsonpath(res, '$..testPaperUrls')[0]
with assume: assert res['code'] == 0
with assume: assert res['msg'] == '成功'
with assume: assert res_contactInfo == edit_data['contactInfo']
with assume: assert res_studentName == edit_data['studentName']
with assume: assert res_testPaperUrls == edit_data['testPaperUrls']
@pytest.mark.usefixtures
def test_edit_my_new_clue_with_morethan_ten_file(self,query_all_following_clues):
def test_edit_my_new_clue_with_more_than_ten_file(self, query_all_following_clues):
"""编辑线索,上传文件超过十个"""
# 查询第一条线索id
first_clue_id = query_all_following_clues['id']
......@@ -228,65 +408,720 @@ class TestMyNewClue():
# 用第一条线索的返回值,作为编辑线索的data
edit_data.pop('status')
edit_data.pop('statusTranslate')
edit_data['studentName']='lq多附件{}'.format(get_time())
edit_data['contactInfo']=get_mobile()
edit_data['studentName'] = 'lq多附件{}'.format(get_time())
edit_data['contactInfo'] = get_mobile()
edit_data['cityName'] = "四川省-成都市"
edit_data['id'] = first_clue_id
edit_data['belong'] = "PERSON"
edit_data['testPaperUrls'] = "https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/63a0757824c856b31312f9d8a0c60c52.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/63a0757824c856b31312f9d8a0c60c52.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/4556a3e12fdc1b4e5beb33e4743e7c48.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/14dc4d32bec5f1ab41c657dea8fd225d.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/727cd885cac14da50184628bbd86738b.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/5275ba540e26e3606cd53c4cd618cdb9.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/3f9d98159775a1bf9aca2c7a0bf25a27.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/e3243c2c422c5a8c88b17c015e9657ba.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/b716298e7276bbc3a9401379ab1251b2.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/499abd25a5ae9b28cab28f26c17d08e7.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/a473f799b65cd31bed4937a79615902e.jpeg"
print('编辑传入的edit_data:',edit_data)
res = clue_manualInputEdit_post(body=edit_data,header=jyy_header,default_assert=False)
print('编辑线索后的返回值',res)
with assume:assert res['code']==100210006
edit_data[
'testPaperUrls'] = "https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/63a0757824c856b31312f9d8a0c60c52.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/63a0757824c856b31312f9d8a0c60c52.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/4556a3e12fdc1b4e5beb33e4743e7c48.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/14dc4d32bec5f1ab41c657dea8fd225d.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/727cd885cac14da50184628bbd86738b.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/5275ba540e26e3606cd53c4cd618cdb9.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/3f9d98159775a1bf9aca2c7a0bf25a27.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/e3243c2c422c5a8c88b17c015e9657ba.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/b716298e7276bbc3a9401379ab1251b2.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/499abd25a5ae9b28cab28f26c17d08e7.jpeg,https://profile-1257124244.cos.ap-chengdu.myqcloud.com/img/a473f799b65cd31bed4937a79615902e.jpeg"
print('编辑传入的edit_data:', edit_data)
res = clue_manualInputEdit_post(body=edit_data, header=jyy_header, default_assert=False)
print('编辑线索后的返回值', res)
with assume: assert res['code'] == 100210006
def test_edit_my_new_clue_with_wrong_file(self):
"""新增线索,上传非图片文件格式"""
# 查询第一条线索id
json_data = Add_My_New_Clue().add_clue_data
with open(r'E:\interface\jk_interface_test\requirements.txt',mode='r',encoding='utf8') as f:
with open(r'E:\interface\jk_interface_test\requirements.txt', mode='r', encoding='utf8') as f:
json_data['testPaperUrls'] = f.read()
print('传入的data值----》》》',json_data)
res = clue_manualInputAdd_post(body=json_data, header=jyy_header,default_assert=False)
print('传入的data值----》》》', json_data)
res = clue_manualInputAdd_post(body=json_data, header=jyy_header, default_assert=False)
# TODO:上传非图片格式的文件,实际新建成功了,后端未限制格式!!!
with assume:assert res['code']==100210003 # 实际运行,code==0,这条用例失败
# def test_query_all_following_clue(self):
# """
# 查询所有【我的新线索-跟进中】线索
# """
# # query_data={"belong":"PERSON","status":"FOLLOWING","pageNum":1,"pageSize":10,"orderType":"desc","orderField":"id","schoolAreas":[3015]}
# query_data={"belong":"PERSON","status":"FOLLOWING","pageNum":1,"pageSize":10,"inChargeEmployeeId":8223,"orderType":"desc","orderField":"id","distribution":0}
# res = clue_queryAll_post(body=query_data,header=jyy_header)
#
# with assume:assert res['code']==0
# with assume:assert res['msg']=="成功"
#
# @pytest.mark.usefixtures
# def test_query_single_clue(self,query_all_following_clues):
# """
# 查询单个线索
# """
# first_clue_id = query_all_following_clues['id']
# params_data = {'clueId':first_clue_id}
# res = clue_query_id_get(params=params_data,header=jyy_header)
# res_clueId = jsonpath(res,'$..clueId')
#
# with assume:assert res['code']==0
# with assume:assert res['msg']=="成功"
# with assume:assert res_clueId==first_clue_id
with assume: assert res['code'] == 100210003 # 实际运行,code==0,这条用例失败
def test_query_all_following_clue(self):
"""
查询所有【我的新线索-跟进中】线索
"""
# query_data={"belong":"PERSON","status":"FOLLOWING","pageNum":1,"pageSize":10,"orderType":"desc","orderField":"id","schoolAreas":[3015]}
query_data = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10,
"inChargeEmployeeId": 8223, "orderType": "desc", "orderField": "id", "distribution": 0}
res = clue_queryAll_post(body=query_data, header=jyy_header)
with assume: assert res['code'] == 0
with assume: assert res['msg'] == "成功"
@pytest.mark.usefixtures
def test_query_single_clue(self, query_all_following_clues):
"""
查询单个线索
"""
first_clue_id = query_all_following_clues['id']
params_data = {'clueId': first_clue_id}
res = clue_query_id_get(params=params_data, header=jyy_header)
res_clueId = jsonpath(res, '$..clueId')
with assume: assert res['code'] == 0
with assume: assert res['msg'] == "成功"
with assume: assert res_clueId == first_clue_id
def test_query_no_clue(self):
"""
查询结果无数据
"""
query_data = {"belong":"PERSON","status":"FOLLOWING","pageNum":1,"pageSize":10,"studentName":"没有这个线索","orderType":"desc","orderField":"id","schoolAreas":[3015]}
query_data = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10, "studentName": "没有这个线索",
"orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
with assume: assert res['code'] == 0
with assume: assert res['msg'] == "成功"
with assume: assert res['data']['total'] == 0
def test_query_following_clue_with_name(self):
"""
根据学生姓名查询
inChargeEmployeeId=8223,createSchoolAreaId=3015
"""
json_data = Add_My_New_Clue().add_clue_data
clue_inChargeEmployeeId = json_data['inChargeEmployeeId']
clue_createSchoolAreaId = json_data['createSchoolAreaId']
add_res = clue_manualInputAdd_post(body=json_data, header=jyy_header)
query_data = OperationDb().query_sql(
"select student_name,contact_type,contact_info,second_contact_type,second_contact_info from service_crm.clue_basic_info WHERE clue_id = (SELECT id FROM service_crm.clue WHERE create_school_area_id ={} and in_charge_employee_id = {} and status = 'FOLLOWING' LIMIT 1);".format(
clue_createSchoolAreaId, clue_inChargeEmployeeId))[0]
print('查询数据库的线索---》》》', query_data)
studentName = query_data[0]
query_data = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10,
"studentName": studentName, "orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
res_studentName = jsonpath(res, '$..studentName')
print('这是返回后的姓名列表--->>>>>', res_studentName)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res_studentName:
for clue_studentName in res_studentName:
with assume: assert clue_studentName == studentName
else:
return '按姓名查询列表没有数据'
def test_query_following_clue_with_phone(self):
"""
根据电话号码查询
"""
json_data = Add_My_New_Clue().add_clue_data
clue_contactInfo = json_data['contactInfo']
clue_inChargeEmployeeId = json_data['inChargeEmployeeId']
clue_createSchoolAreaId = json_data['createSchoolAreaId']
add_res = clue_manualInputAdd_post(body=json_data, header=jyy_header)
query_data = OperationDb().query_sql(
"select student_name,contact_type,contact_info,second_contact_type,second_contact_info from service_crm.clue_basic_info WHERE clue_id = (SELECT id FROM service_crm.clue WHERE create_school_area_id ={} and in_charge_employee_id = {} and status = 'FOLLOWING' LIMIT 1);".format(
clue_createSchoolAreaId, clue_inChargeEmployeeId))[0]
print('查询数据库的线索---》》》', query_data)
studentName = query_data[0]
query_data = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10,
"studentName": clue_contactInfo, "orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
res_contactInfo = jsonpath(res, '$..contactInfo')
print('这是返回后的姓名列表--->>>>>', res_contactInfo)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res_contactInfo:
for res_clue_contactInfo in res_contactInfo:
with assume: assert res_clue_contactInfo == clue_contactInfo
else:
return '按电话查询列表没有数据'
def test_query_following_clue_with_intentionLevel(self):
"""
根据意向级别查询 intentionLevel: "S" "A" "B" "C"
"""
intentionLevel_list = ["S", "A", "B", "C"]
for intentionLevel in intentionLevel_list:
query_data = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10,
"intentionLevel": intentionLevel, "orderType": "desc", "orderField": "id",
"schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
res_intentionLevel = jsonpath(res, '$..intentionLevel')
print('这是返回后的姓名列表--->>>>>', res_intentionLevel)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res_intentionLevel:
for res_clue_intentionLevel in res_intentionLevel:
with assume: assert res_clue_intentionLevel == query_data['intentionLevel']
else:
print('按意向级别查询列表没有数据!')
def test_query_following_clue_with_sourceId(self):
"""
根据线索来源查询 sourceId: 100 线上营销 101自然口碑 102 营销活动 103 营销口碑 104 线下营销
"""
sourceId_list = [100, 101, 102, 103, 104]
for sourceId in sourceId_list:
query_data = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10, "sourceId": sourceId,
"orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
res_sourceId = jsonpath(res, '$..sourceId')
print('这是返回后的姓名列表--->>>>>', res_sourceId)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res_sourceId:
for res_clue_sourceId in res_sourceId:
with assume: assert res_clue_sourceId == query_data['sourceId']
else:
print('按线索来源查询列表没有数据!')
def test_query_following_clue_with_publicGrade(self):
"""
根据年级查询 publicGrade: 零年级,一年级,二年级,三年级,四年级,五年级,六年级,七年级,八年级,九年级,高一,高二,高三
"""
publicGrade_list = ['零年级', '一年级', '二年级', '三年级', '四年级', '五年级', '六年级', '七年级', '八年级', '九年级', '高一', '高二', '高三']
for publicGrade in publicGrade_list:
query_data = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10,
"publicGrade": publicGrade, "orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
res_publicGrade = jsonpath(res, '$..sourceId')
print('这是返回后的姓名列表--->>>>>', res_publicGrade)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res_publicGrade:
for res_clue_publicGrade in res_publicGrade:
with assume: assert res_clue_publicGrade == query_data['publicGrade']
else:
print('按年级查询列表没有数据!')
def test_query_following_clue_with_followingStatus(self):
"""
根据跟进状态查询 followingStatus: "OVERTIME"已逾期,"UNFOLLOWED"未跟进,"FOLLOWING"跟进中
"""
followingStatus_list = ["OVERTIME", "UNFOLLOWED", "FOLLOWING"]
for followingStatus in followingStatus_list:
query_data = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10,
"followingStatus": followingStatus, "orderType": "desc", "orderField": "id",
"schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
res_followingStatus = jsonpath(res, '$..sourceId')
print('这是返回后的姓名列表--->>>>>', res_followingStatus)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res_followingStatus:
for res_clue_publicGrade in res_followingStatus:
with assume: assert res_clue_publicGrade == query_data['followingStatus']
else:
print('按跟进状态查询列表没有数据!')
def test_query_following_clue_with_create_time(self):
"""
根据录入时间查询 field: "create_time"
"""
# 录入时间--今天
create_time = get_today()
query_data = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10, "field": "create_time",
"fieldBeginDateStr": create_time, "fieldEndDateStr": create_time, "orderType": "desc",
"orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
res_createTimeStr = jsonpath(res, '$..createTimeStr')
print('这是返回后的录入时间列表--->>>>>', res_createTimeStr)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res_createTimeStr:
for res_clue_createTimeStr in res_createTimeStr:
res_clue_createTimeStr = day_transform_time(res_clue_createTimeStr)
with assume: assert res_clue_createTimeStr == create_time
else:
print('按录入时间--今天,查询列表没有数据!')
def test_query_following_clue_with_next_follow_time(self):
"""
根据计划跟进时间查询 field: "next_follow_time"
"""
# 录入时间--今天
create_time = get_today()
query_data = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10,
"field": "next_follow_time", "fieldBeginDateStr": create_time, "fieldEndDateStr": create_time,
"orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
res_nextFollowTimeStr = jsonpath(res, '$..nextFollowTimeStr')
print('这是返回后的计划跟进时间列表--->>>>>', res_nextFollowTimeStr)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res_nextFollowTimeStr:
for res_clue_nextFollowTimeStr in res_nextFollowTimeStr:
with assume: assert res_clue_nextFollowTimeStr == query_data['fieldBeginDateStr']
else:
print('按计划跟进时间--今天,查询列表没有数据!')
def test_query_following_clue_with_last_follow_time(self):
"""
根据末次跟进时间查询 field: "last_follow_time"
"""
# 录入时间--今天
create_time = get_today()
query_data = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10,
"field": "last_follow_time", "fieldBeginDateStr": create_time, "fieldEndDateStr": create_time,
"orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
res_lastFollowTimeStr = jsonpath(res, '$..lastFollowTimeStr')
print('这是返回后的末次跟进列表--->>>>>', res_lastFollowTimeStr)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res_lastFollowTimeStr:
for res_clue_lastFollowTimeStr in res_lastFollowTimeStr:
res_clue_lastFollowTimeStr = day_transform_time(res_clue_lastFollowTimeStr)
with assume: assert res_clue_lastFollowTimeStr == create_time
else:
print('按末次跟进时间--今天,查询列表没有数据!')
def test_query_following_clue_with_all_condition(self):
"""
根据学生姓名&amp;电话号码 + 意向级别+线索来源+年级+计划跟进时间/末次跟进时间/录入时间+跟进状态
"""
create_time = get_today()
query_data = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10,
"studentName": "lq1620634324", "intentionLevel": "S", "sourceId": 101, "publicGrade": "三年级",
"followingStatus": "UNFOLLOWED", "field": "last_follow_time", "fieldBeginDateStr": "2021-05-10",
"fieldEndDateStr": "2021-05-10", "orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res['data']['list']:
for data in res['data']['list']:
with assume: assert data['studentName'] == query_data['studentName']
with assume: assert data['intentionLevel'] == query_data['intentionLevel']
with assume: assert data['sourceId'] == query_data['sourceId']
with assume: assert data['publicGrade'] == query_data['publicGrade']
with assume: assert data['status'] == query_data['followingStatus']
data['lastFollowTimeStr'] = day_transform_time(data['lastFollowTimeStr'])
with assume: assert data['lastFollowTimeStr'] == create_time
else:
print('查询列表没有符合条件的数据!')
def test_query_following_clue_with_name_and_intentionLevel(self):
"""
根据学生姓名+ 意向级别查询
"""
intentionLevel_list = ["S", "A", "B", "C"]
intentionLevel = random.sample(intentionLevel_list, 1)
query_data = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10,
"studentName": "lq1620645970", "intentionLevel": intentionLevel, "orderType": "desc",
"orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res['data']['list']:
for data in res['data']['list']:
with assume: assert data['studentName'] == query_data['studentName']
with assume: assert data['intentionLevel'] == query_data['intentionLevel']
else:
print('查询列表没有符合条件的数据!')
def test_query_following_clue_with_name_and_intentionLevel_and_sourceId(self):
"""
根据学生姓名 + 意向级别+线索来源
"""
intentionLevel_list = ["S", "A", "B", "C"]
sourceId_list = [100, 101, 102, 103, 104]
intentionLevel = random.sample(intentionLevel_list, 1)
sourceId = random.sample(sourceId_list, 1)
query_data = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10,
"studentName": "lq1620645970", "intentionLevel": intentionLevel, "sourceId": sourceId,
"orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res['data']['list']:
for data in res['data']['list']:
with assume: assert data['studentName'] == query_data['studentName']
with assume: assert data['intentionLevel'] == query_data['intentionLevel']
with assume: assert data['sourceId'] == query_data['sourceId']
else:
print('查询列表没有符合条件的数据!')
def test_query_following_clue_with_grade_and_next_follow_time(self):
"""
根据年级+末次跟进时间/计划跟进时间/录入时间
"""
publicGrade_list = ['零年级', '一年级', '二年级', '三年级', '四年级', '五年级', '六年级', '七年级', '八年级', '九年级', '高一', '高二', '高三']
publicGrade = random.sample(publicGrade_list, 1)[0]
create_time = get_today()
query_data = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10,
"publicGrade": publicGrade, "field": "create_time", "fieldBeginDateStr": create_time,
"fieldEndDateStr": create_time, "orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res['data']['list']:
for data in res['data']['list']:
with assume: assert data['publicGrade'] == query_data['publicGrade']
with assume: assert data['nextFollowTimeStr'] == create_time
else:
print('查询列表没有符合条件的数据!')
def test_query_following_clue_with_followingStatus_and_next_follow_time(self):
"""
根据跟进状态+计划跟进时间 查询
"""
followingStatus_list = ["OVERTIME", "UNFOLLOWED", "FOLLOWING"]
followingStatus = random.sample(followingStatus_list, 1)[0]
create_time = get_today()
query_data = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10,
"followingStatus": followingStatus, "field": "next_follow_time", "fieldBeginDateStr": create_time,
"fieldEndDateStr": create_time, "orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res['data']['list']:
for data in res['data']['list']:
with assume: assert data['status'] == query_data['followingStatus']
with assume: assert data['nextFollowTimeStr'] == create_time
else:
print('查询列表没有符合条件的数据!')
def test_query_following_clue_with_followingStatus_and_create_time(self):
"""
根据跟进状态+录入时间 查询
"""
followingStatus_list = ["OVERTIME", "UNFOLLOWED", "FOLLOWING"]
followingStatus = random.sample(followingStatus_list, 1)[0]
create_time = get_today()
query_data = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10,
"followingStatus": followingStatus, "field": "create_time", "fieldBeginDateStr": create_time,
"fieldEndDateStr": create_time, "orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res['data']['list']:
for data in res['data']['list']:
with assume: assert data['status'] == query_data['followingStatus']
data['createTimeStr'] = day_transform_time(data['createTimeStr'])
with assume: assert data['createTimeStr'] == create_time
else:
print('查询列表没有符合条件的数据!')
def test_query_transformed_clue_with_no_condition(self):
"""
我的线索-已转化列表无条件默认查询
"""
query_data = {"belong": "PERSON", "status": "HASTRANSFORMED", "pageNum": 1, "pageSize": 10, "orderType": "desc",
"orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
res_status = jsonpath(res, '$..status')
print('这是返回后的所有线索--->>>>>', res)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res_status:
for status in res_status:
with assume: assert status == query_data['status']
else:
print('默认条件搜索列表无返回结果!')
def test_query_transformed_clue_with_student_name(self):
""" 我的线索-已转化列表,根据学生姓名查询"""
with assume:assert res['code']==0
with assume:assert res['msg']=="成功"
with assume:assert res['data']['total']==0
\ No newline at end of file
query_data = {"belong": "PERSON", "status": "HASTRANSFORMED", "pageNum": 1, "pageSize": 10, "studentName": 'lq',
"orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
res_studentName = jsonpath(res, '$..studentName')
print('这是返回后的所有线索--->>>>>', res)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res_studentName:
for name in res_studentName:
with assume: assert query_data['studentName'] in name
else:
print('我的线索-已转化列表,按学生姓名搜索列表无返回结果!')
def test_query_transformed_clue_with_phone(self):
""" 我的线索-已转化列表,根据学生电话号码查询"""
query_data = {"belong": "PERSON", "status": "HASTRANSFORMED", "pageNum": 1, "pageSize": 10,
"studentName": "19457952447", "orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
res_contactInfo = jsonpath(res, '$..contactInfo')
print('这是返回后的所有线索--->>>>>', res)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res_contactInfo:
for contactInfo in res_contactInfo:
with assume: assert contactInfo == query_data['studentName']
else:
print('我的线索-已转化列表,按学生电话搜索列表无返回结果!')
def test_query_transformed_clue_with_sourceId(self):
""" 我的线索-已转化列表,根据线索来源查询"""
sourceId_list = [100, 101, 102, 103, 104]
sourceId = random.sample(sourceId_list, 1)[0]
query_data = {"belong": "PERSON", "status": "HASTRANSFORMED", "pageNum": 1, "pageSize": 10,
"sourceId": sourceId, "orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
res_sourceId = jsonpath(res, '$..sourceId')
print('这是返回后的所有线索--->>>>>', res)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res_sourceId:
for sourceId in res_sourceId:
with assume: assert sourceId == query_data['sourceId']
else:
print('我的线索-已转化列表,按线索来源搜索列表无返回结果!')
def test_query_transformed_clue_with_last_follow_time(self):
""" 我的线索-已转化列表,根据末次跟进时间查询"""
last_follow_time = get_today()
query_data = {"belong": "PERSON", "status": "HASTRANSFORMED", "pageNum": 1, "pageSize": 10,
"field": "last_follow_time", "fieldBeginDateStr": last_follow_time,
"fieldEndDateStr": last_follow_time, "orderType": "desc", "orderField": "id",
"schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
res_lastFollowTimeStr = jsonpath(res, '$..lastFollowTimeStr')
print('这是返回后的所有线索--->>>>>', res)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res_lastFollowTimeStr:
for res_clue_lastFollowTimeStr in res_lastFollowTimeStr:
res_clue_lastFollowTimeStr = day_transform_time(res_clue_lastFollowTimeStr)
with assume: assert res_clue_lastFollowTimeStr == last_follow_time
else:
print('我的线索-已转化列表,按末次跟进时间搜索列表无返回结果!')
def test_query_transformed_clue_with_status_change_time(self):
""" 我的线索-已转化列表,根据转化时间查询"""
status_change_time = get_today()
query_data = {"belong": "PERSON", "status": "HASTRANSFORMED", "pageNum": 1, "pageSize": 10,
"field": "status_change_time", "fieldBeginDateStr": status_change_time,
"fieldEndDateStr": status_change_time, "orderType": "desc", "orderField": "id",
"schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
res_statusChangeTimeStr = jsonpath(res, '$..statusChangeTimeStr')
print('这是返回后的所有线索--->>>>>', res)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res_statusChangeTimeStr:
for res_clue_statusChangeTimeStr in res_statusChangeTimeStr:
res_clue_statusChangeTimeStr = day_transform_time(res_clue_statusChangeTimeStr)
with assume: assert res_clue_statusChangeTimeStr == status_change_time
else:
print('我的线索-已转化列表,按转化时间搜索列表无返回结果!')
def test_query_transformed_clue_with_create_time(self):
""" 我的线索-已转化列表,根据录入时间查询"""
create_time = get_today()
query_data = {"belong": "PERSON", "status": "HASTRANSFORMED", "pageNum": 1, "pageSize": 10,
"field": "create_time", "fieldBeginDateStr": create_time, "fieldEndDateStr": create_time,
"orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
res_createTimeStr = jsonpath(res, '$..createTimeStr')
print('这是返回后的所有线索--->>>>>', res)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res_createTimeStr:
for res_clue_createTimeStrr in res_createTimeStr:
res_clue_createTimeStrr = day_transform_time(res_clue_createTimeStrr)
with assume: assert res_clue_createTimeStrr == create_time
else:
print('我的线索-已转化列表,按录入时间搜索列表无返回结果!')
def test_query_transformed_clue_with_publicGrade(self):
""" 我的线索-已转化列表,根据年级查询"""
publicGrade_list = ['零年级', '一年级', '二年级', '三年级', '四年级', '五年级', '六年级', '七年级', '八年级', '九年级', '高一', '高二', '高三']
publicGrade = random.sample(publicGrade_list, 1)[0]
query_data = {"belong": "PERSON", "status": "HASTRANSFORMED", "pageNum": 1, "pageSize": 10,
"publicGrade": publicGrade, "orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
res_publicGrade = jsonpath(res, '$..publicGrade')
print('这是返回后的所有线索--->>>>>', res)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res_publicGrade:
for publicGrade in res_publicGrade:
with assume: assert publicGrade == query_data['publicGrade']
else:
print('我的线索-已转化列表,按年级搜索列表无返回结果!')
def test_query_transformed_clue_with_all_condition(self):
"""
根据学生姓名&amp;电话号码 + 线索来源 + 末次跟进时间/转化时间/录入时间+ 年级
"""
status_change_time = get_today()
sourceId_list = [100, 101, 102, 103, 104]
sourceId = random.sample(sourceId_list, 1)[0]
publicGrade_list = ['零年级', '一年级', '二年级', '三年级', '四年级', '五年级', '六年级', '七年级', '八年级', '九年级', '高一', '高二', '高三']
publicGrade = random.sample(publicGrade_list, 1)[0]
query_data = {"belong": "PERSON", "status": "UNTRANSFORMED", "pageNum": 1, "pageSize": 10, "studentName": "lq",
"sourceId": sourceId, "publicGrade": publicGrade, "field": "status_change_time",
"fieldBeginDateStr": status_change_time, "fieldEndDateStr": status_change_time,
"orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res['data']['list']:
for data in res['data']['list']:
with assume: assert query_data['studentName'] in data['studentName']
with assume: assert data['sourceId'] == query_data['sourceId']
with assume: assert data['publicGrade'] == query_data['publicGrade']
data['statusChangeTimeStr'] = day_transform_time(data['statusChangeTimeStr'])
with assume: assert data['statusChangeTimeStr'] == status_change_time
else:
print('查询列表没有符合条件的数据!')
def test_query_transformed_clue_with_name_and_sourceId(self):
"""
根据学生姓名 + 线索来源
"""
sourceId_list = [100, 101, 102, 103, 104]
sourceId = random.sample(sourceId_list, 1)[0]
query_data = {"belong": "PERSON", "status": "HASTRANSFORMED", "pageNum": 1, "pageSize": 10, "studentName": "lq",
"sourceId": sourceId, "orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res['data']['list']:
for data in res['data']['list']:
with assume: assert query_data['studentName'] in data['studentName']
with assume: assert data['sourceId'] == query_data['sourceId']
else:
print('查询列表没有符合条件的数据!')
def test_query_transformed_clue_with_name_and_sourceId_and_last_follow_time(self):
"""
根据学生姓名+ 线索来源 + 末次跟进时间
"""
last_follow_time = get_today()
sourceId_list = [100, 101, 102, 103, 104]
sourceId = random.sample(sourceId_list, 1)[0]
query_data = {"belong": "PERSON", "status": "HASTRANSFORMED", "pageNum": 1, "pageSize": 10, "studentName": "lq",
"sourceId": sourceId, "field": "last_follow_time", "fieldBeginDateStr": last_follow_time,
"fieldEndDateStr": last_follow_time, "orderType": "desc", "orderField": "id",
"schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res['data']['list']:
for data in res['data']['list']:
with assume: assert query_data['studentName'] in data['studentName']
with assume: assert data['sourceId'] == query_data['sourceId']
data['lastFollowTimeStr'] = day_transform_time(data['lastFollowTimeStr'])
with assume: assert data['lastFollowTimeStr'] == last_follow_time
else:
print('查询列表没有符合条件的数据!')
def test_query_transformed_clue_with_sourceId_and_publicGrade_and_last_follow_time(self):
"""
根据线索来源 + 末次跟进时间 + 年级
"""
last_follow_time = get_today()
sourceId_list = [100, 101, 102, 103, 104]
sourceId = random.sample(sourceId_list, 1)[0]
publicGrade_list = ['零年级', '一年级', '二年级', '三年级', '四年级', '五年级', '六年级', '七年级', '八年级', '九年级', '高一', '高二', '高三']
publicGrade = random.sample(publicGrade_list, 1)[0]
query_data = {"belong": "PERSON", "status": "HASTRANSFORMED", "pageNum": 1, "pageSize": 10,
"sourceId": sourceId, "publicGrade": publicGrade, "field": "last_follow_time",
"fieldBeginDateStr": last_follow_time, "fieldEndDateStr": last_follow_time, "orderType": "desc",
"orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
with assume:
assert res['code'] == 0
with assume:
assert res['msg'] == "成功"
if res['data']['list']:
for data in res['data']['list']:
with assume: assert data['sourceId'] == query_data['sourceId']
with assume: assert data['publicGrade'] == query_data['publicGrade']
data['lastFollowTimeStr'] = day_transform_time(data['lastFollowTimeStr'])
with assume: assert data['lastFollowTimeStr'] == last_follow_time
else:
print('查询列表没有符合条件的数据!')
def test_query_transformed_clue_with_no_res(self):
"""
条件查询无数据
"""
query_data = {"belong": "PERSON", "status": "HASTRANSFORMED", "pageNum": 1, "pageSize": 10,
"studentName": "ssssssssssss", "orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res = clue_queryAll_post(body=query_data, header=jyy_header)
print('这是返回后的所有线索--->>>>>', res)
with assume: assert res['code'] == 0
with assume: assert res['msg'] == "成功"
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