Commit 98ba8dd9 authored by 刘琴's avatar 刘琴

查询所有线索+新增线索(必填项)+查询单个线索

parent 9ce59f5d
......@@ -2,7 +2,7 @@
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.8" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.7" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
Index: run.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
<+>import pytest\nimport os\n\n\nif __name__ == '__main__':\n run_config = [\n \"-s\", \"./script/ji_yun_ying_app\", \"--alluredir\", \"./report/xml\", \"--host=http://172.10.62.94:3000\",\n ]\n pytest.main(run_config)\n # os模块运行allure命令,来生成html格式的报告(根据刚刚生成的配置信息)\n # os.system(\"/Users/huangqiang/WorkPlace/allure-2.13.8/bin/allure generate ./report/xml -o ./report/html --clean\")\n
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- run.py (revision afc678929e714343bc935d0e182aeb8e4de75fff)
+++ run.py (date 1618196902142)
@@ -8,4 +8,4 @@
]
pytest.main(run_config)
# os模块运行allure命令,来生成html格式的报告(根据刚刚生成的配置信息)
- # os.system("/Users/huangqiang/WorkPlace/allure-2.13.8/bin/allure generate ./report/xml -o ./report/html --clean")
+ os.system("/Users/huangqiang/WorkPlace/allure-2.13.8/bin/allure generate ./report/xml -o ./report/html --clean")
\ No newline at end of file
<changelist name="Uncommitted_changes_before_Checkout_at_2021_4_12,_11_11_[Default_Changelist]1" date="1618197069375" recycled="true" deleted="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_2021_4_12,_11_11_[Default_Changelist]1/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Checkout at 2021/4/12, 11:11 [Default Changelist]" />
</changelist>
\ No newline at end of file
This diff is collapsed.
......@@ -7,8 +7,9 @@ from common.common_util import replace_string
def get_cases(path):
with open(path, 'r', encoding='utf-8') as file:
case_content_json = json.loads(file.read())
with open(path, 'r', encoding='utf8') as file:
# print(file.read())
case_content_json = json.loads(re.findall("\{.*\}", file.read())[0])
entries = case_content_json.get("log").get("entries")
step_lists = []
for entry in entries:
......@@ -145,7 +146,7 @@ ${import_datas}
"""
if __name__ == '__main__':
file_path = "/Users/huangqiang/Desktop/order.har"
file_path = "D:/lq_url2.har"
current_method = get_current_method()
create_file(get_cases(file_path), is_assert=False)
......@@ -3,12 +3,18 @@ import os
if __name__ == '__main__':
run_config = [
"-s", "script/xin_project_patriarch_app",
"-s", r"script\ji_yun_ying_pc\service_crm_liuqin\testcase_clue\test_my_new_clue.py",
"--clean-alluredir",
"--alluredir", "./report/xml",
"--host", "http://172.10.62.94",
"--account", "b",
"--host", "http://192.168.32.31",
"--account", "A",
"--db", "36"
]
x = pytest.main(run_config)
# os模块运行allure命令,来生成html格式的报告(根据刚刚生成的配置信息)
os.system("allure generate ./report/xml -o ./report/html --clean")
......@@ -10,7 +10,8 @@ from script.base_api.service_user.departments import departments_schools_get
def pytest_addoption(parser):
# 注册一个命令行选项host
parser.addoption("--host", default="http://172.10.62.94", dest="env", help="set test run env")
# parser.addoption("--host", default="http://172.10.62.94", dest="env", help="set test run env")
parser.addoption("--host", default="https://yf1.jkwljy.com", dest="env", help="set test run env")
# 注册一个命令行选项db
parser.addoption("--db", default="yf1", dest="db", help="set test database")
# 注册一个命令行选项account
......
......@@ -4,6 +4,7 @@ accounts = {
"A": {
# 极运营默认账号
"jyy_account": {
# "account": "18224499511",
"account": "15360956010",
"password": "88888888"
},
......
import random
import time
import datetime
def get_mobile():
"""获取手机号"""
mobile = '1' + random.choice(['3','5','7','8','9'])
for i in range(9):
num = random.randint(0,9)
mobile += str(num)
return 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
if __name__ == '__main__':
print(get_mobile())
print(get_time())
print(get_tomorrow_datetime())
\ No newline at end of file
import pytest
from jsonpath import jsonpath
from script.base_api import clue_manualInputAdd_post, clue_queryAll_post
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
@pytest.fixture
def add_my_clue():
"""添加我的新线索"""
json_data = Add_My_New_Clue().add_clue_data
studentName = json_data['studentName']
contactInfo=json_data['contactInfo']
res = clue_manualInputAdd_post(body=json_data,header=jyy_header)
yield {'studentName':studentName,'contactInfo':contactInfo}
@pytest.fixture()
def query_all_following_clues(add_my_clue):
"""查询我的线索-跟进中"""
query_data = {"belong": "PERSON", "status": "FOLLOWING", "pageNum": 1, "pageSize": 10,
"orderType": "desc", "orderField": "id", "schoolAreas": [3015]}
res_query_data = clue_queryAll_post(body=query_data,header=jyy_header)
contactInfo=jsonpath(res_query_data,'$..contactInfo')[0]
studentName=jsonpath(res_query_data,'$..studentName')[0]
id=jsonpath(res_query_data,'$..id')[0]
yield {'contactInfo':contactInfo,'studentName':studentName,'id':id}
import json
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
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
# 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
#
#
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_edit_my_new_clue(self):
# """编辑线索"""
# res = clue_manualInputEdit_post(header=jyy_header)
def test_query_following_clue(self):
"""
查询所有【我的新线索-跟进中】线索
"""
query_data={"belong":"PERSON","status":"FOLLOWING","pageNum":1,"pageSize":10,"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']=="成功"
@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
......@@ -4,7 +4,7 @@
server: http://172.10.62.94
user: 13555555555
- headers:
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiIyMTc1IiwidGVybWluYWwiOiJwYyIsInV1aWQiOiI0NGIxZTk5ZTJhOTk0ZTVhYmY2MzdiZTFmZGVkN2NiZCIsInRpbWVzdGFtcCI6MTYxODM4NjMyNTk4MX0.vFTRtWmeXXXW9238IaAzIQHuZz6bYTpCLbN1pHcYky0
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiIyMTc1IiwidGVybWluYWwiOiJwYyIsInV1aWQiOiJkMjk5ZWRiNDJlNTU0OTRkYjc3NmE0NTkwM2YwNTIyZCIsInRpbWVzdGFtcCI6MTYxODM5NzI4NDU2Mn0.ZtC_9ky3c_XDMSqL3qfC-YbACj3OOtWyfPhKyzQ5x24
Content-Type: application/json;charset=UTF-8
server: http://192.168.32.31
user: 13555555555
......@@ -1336,3 +1336,51 @@
server: http://192.168.32.31
user: '16714154557'
userId: 696660
- headers:
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiI2OTY2NzIiLCJ0ZXJtaW5hbCI6ImFwcCIsInV1aWQiOiI4YTEwZDU1Nzk0ODg0ZDA2OWRmY2ZlYzM5MGYyZmVhYyIsInRpbWVzdGFtcCI6MTYxODM5NzY3MTE2NH0.8J6ndWn8PcGu7oWV2fX8nwvetkBUDcs0CYwf0EALXpc
Content-Type: application/json;charset=UTF-8
server: http://192.168.32.31
user: '18914185429'
userId: 696672
- headers:
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiI2OTY2NzMiLCJ0ZXJtaW5hbCI6ImFwcCIsInV1aWQiOiJmNTE1NDVhODU0MWE0MjYwYjg4MGM4N2UxMzI1YTNjMiIsInRpbWVzdGFtcCI6MTYxODM5NzY3OTc3Mn0.5q_Z8bMz_i-4gQ3bgn7fH1PHnwS8LZZlvjIQM2mU7wU
Content-Type: application/json;charset=UTF-8
server: http://192.168.32.31
user: '13314185438'
userId: 696673
- headers:
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiI2OTY2NzQiLCJ0ZXJtaW5hbCI6ImFwcCIsInV1aWQiOiJkNGQ4NzY4N2NlMTI0OTVjOTY3NjFiNmYxZmZlOGEzNyIsInRpbWVzdGFtcCI6MTYxODM5NzY4NjY3NX0.hUTR-us7tDjN6omEvCJdlnbHe1cjW9t2qZywlqgJQyY
Content-Type: application/json;charset=UTF-8
server: http://192.168.32.31
user: '13314185440'
userId: 696674
- headers:
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiI2OTY2NzUiLCJ0ZXJtaW5hbCI6ImFwcCIsInV1aWQiOiJiMWVlYTAxOTc5MGQ0MmIzYmZhMjg1YTcxNDQ3ZTMxNyIsInRpbWVzdGFtcCI6MTYxODM5NzY5MjMyNH0.tYM7B8u9JucPTQNFEbj7wW0mlYI2V62ofEA_gwgdozo
Content-Type: application/json;charset=UTF-8
server: http://192.168.32.31
user: '16714185448'
userId: 696675
- headers:
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiI2OTY2NzYiLCJ0ZXJtaW5hbCI6ImFwcCIsInV1aWQiOiJhYmVlMDZjODJjNTc0NTBhYTJiNDFjZjhlZDY2ODYwMyIsInRpbWVzdGFtcCI6MTYxODM5Nzg1MDczNn0.Qm3mSD5Yr6BTKBcqZdPSSHQ8xGrv9NmiABG08okwszg
Content-Type: application/json;charset=UTF-8
server: http://192.168.32.31
user: '18914185729'
userId: 696676
- headers:
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiI2OTY2NzciLCJ0ZXJtaW5hbCI6ImFwcCIsInV1aWQiOiJmM2VhY2EyN2VmYmY0OGM3OGQ0MmQyMWUxNTNkMzM1MSIsInRpbWVzdGFtcCI6MTYxODM5Nzg1OTExOX0._srG28HiJVk1yXr2Lo3uBQ36WYm8pxw6JwBBqd0fqBI
Content-Type: application/json;charset=UTF-8
server: http://192.168.32.31
user: '13314185738'
userId: 696677
- headers:
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiI2OTY2NzgiLCJ0ZXJtaW5hbCI6ImFwcCIsInV1aWQiOiI4ZTdkYmI4MTJiZjk0ZjM4YmY4MzNjODk0NzAzOWYyZSIsInRpbWVzdGFtcCI6MTYxODM5Nzg2NjE3MX0.xXWEN_5QE27plPNV_3GkHbEBrPXgZWZSMZscuL24JRM
Content-Type: application/json;charset=UTF-8
server: http://192.168.32.31
user: '13314185739'
userId: 696678
- headers:
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiI2OTY2NzkiLCJ0ZXJtaW5hbCI6ImFwcCIsInV1aWQiOiI1Y2YyOTg4MWIzNjQ0ZThkODljM2IwY2U3MTBmZjdiYyIsInRpbWVzdGFtcCI6MTYxODM5Nzg3MjEzN30.ibDQY3IGwDnNCC9ng9qAJejEiYWajKkMiSQAh0LVgRo
Content-Type: application/json;charset=UTF-8
server: http://192.168.32.31
user: '16714185748'
userId: 696679
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