Commit 4ca15137 authored by 刘琴's avatar 刘琴

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

parent 8ba23e78
......@@ -19,10 +19,11 @@
<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$/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/conftest.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/service_crm_liuqin/conftest.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" />
......@@ -202,8 +203,8 @@
<item itemvalue="Python.run" />
<item itemvalue="Python.helpler" />
<item itemvalue="Python.helpler (1)" />
<item itemvalue="Python tests.pytest in test_my_new_clue.py" />
<item itemvalue="Python.conftest" />
<item itemvalue="Python tests.pytest in test_my_new_clue.py" />
</list>
<recent_temporary>
<list>
......@@ -271,7 +272,14 @@
<option name="project" value="LOCAL" />
<updated>1619698276810</updated>
</task>
<option name="localTasksCounter" value="7" />
<task id="LOCAL-00007" summary="编辑线索">
<created>1619777539691</created>
<option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" />
<updated>1619777539691</updated>
</task>
<option name="localTasksCounter" value="8" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
......@@ -296,7 +304,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>
......
......@@ -3,10 +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",
"-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",
"--clean-alluredir",
"--alluredir", "./report/xml",
"--host", "http://192.168.32.31",
# "--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默认账号
......
......@@ -102,6 +102,69 @@ class Add_My_New_Clue():
"schoolCityName": "成都"
"""
class Add_My_New_All_Clue():
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,
schoolName="华阳中学",
publicClass="测试班级", publicTeacher="测试老师", publicGrade="三年级", birthday="2013-05-02",
testPaperUrls="https://test-1257124244.cos.ap-chengdu.myqcloud.com/img/63a0757824c856b31312f9d8a0c60c52.jpeg",
score=999, sourceId=102, intentionLevel="C", introduceStudentId=10170940,
introduceStudentName="lq测试用",
remark="测试新增线索所有项", classRank="12", gradeRank="23", recentScore="111", parentsHope="222",
studyHabit="333", city=510100, schoolProvinceName="四川省", schoolProvinceId=510000,
schoolCityId=510000, schoolCityName="成都"
):
self.add_clue_data = {
"belong": belong,
"studentName": studentName,
"studentSex": studentSex,
"contactType": contactType,
"contactInfo": contactInfo,
"secondContactType": secondContactType,
"secondContactInfo": secondContactInfo,
"inChargeEmployeeId": inChargeEmployeeId,
"homeProvinceId": homeProvinceId,
"homeProvince": homeProvince,
"homeCityId": homeCityId,
"homeCity": homeCity,
"homeDistrictId": homeDistrictId,
"homeDistrict": homeDistrict,
"homeCountyId": homeCountyId,
"homeCounty": homeCounty,
"homeAddress": homeAddress,
"schoolId": schoolId,
"schoolName": schoolName,
"publicClass": publicClass,
"publicTeacher": publicTeacher,
"publicGrade": publicGrade,
"birthday": birthday,
"testPaperUrls": testPaperUrls,
"score": score,
"sourceId": sourceId,
"intentionLevel": intentionLevel,
"introduceStudentId": introduceStudentId,
"introduceStudentName": introduceStudentName,
"introduceStudentNo": introduceStudentNo,
"collectPerson": collectPerson,
"createSchoolAreaId": createSchoolAreaId,
"otherRemark": otherRemark,
"remark": remark,
"classRank": classRank,
"gradeRank": gradeRank,
"recentScore": recentScore,
"parentsHope": parentsHope,
"studyHabit": studyHabit,
"city": city,
"schoolProvinceName": schoolProvinceName,
"schoolProvinceId": schoolProvinceId,
"schoolCityId": schoolCityId,
"schoolCityName": schoolCityName
}
# class Eidt_My_New_Clue():
# def __init__(self,clueId,id,studentName="刘琴修改后{}".format(get_time()),studentSex="NONE",introduceStudentId=None,introduceStudentNo=None,introduceStudentName=None,
# collectPerson="刘琴1",intentionLevel="B",sourceId=101,sourceName="自然口碑",remark="",otherRemark="",birthday="",publicClass="",publicTeacher="",
......
......@@ -6,10 +6,11 @@ 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
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
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'
......@@ -21,6 +22,7 @@ from script.ji_yun_ying_pc.service_crm_liuqin.case_data_handler_liuqin.myNewClue
#
#
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
class TestMyNewClue():
......@@ -28,26 +30,132 @@ class TestMyNewClue():
测试“我的新线索”
"""
# def test_add_new_clue_success(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]
#
#
# with assume:assert res['code']==0
# with assume:assert res['msg']=='成功'
# with assume:assert res_contactInfo==clue_contactInfo
def test_add_new_clue_success(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]
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]
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
@pytest.mark.usefixtures
def test_edit_new_clue_all_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):
# 传入多个校区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
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)
permission_school = res_info['data']['schoolAreaId']
print('有权限的校区---》',permission_school)
json_data = Add_My_New_Clue().add_clue_data
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)
else:
json_data['createSchoolAreaId'] = [1001]
res = clue_manualInputAdd_post(body=json_data,header=jyy_header,default_assert=False)
with assume:assert res['code']==100110001
@pytest.mark.usefixtures
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}
......@@ -56,20 +164,94 @@ class TestMyNewClue():
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']
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']='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']
@pytest.mark.usefixtures
def test_edit_my_new_clue_with_morethan_ten_file(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']='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
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:
json_data['testPaperUrls'] = f.read()
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):
# """
# 查询所有【我的新线索-跟进中】线索
......@@ -97,3 +279,14 @@ class TestMyNewClue():
def test_query_no_clue(self):
"""
查询结果无数据
"""
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
\ No newline at end of file
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