Commit f707cee4 authored by wxh's avatar wxh

极运营APP-我的线索第一期用例

parent 63c1f45b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<module type="PYTHON_MODULE" version="4"> <module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" /> <content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.7 (GeekInterfaceTest)" jdkType="Python SDK" /> <orderEntry type="jdk" jdkName="Python 3.7 (eniv)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
<component name="PyDocumentationSettings"> <component name="PyDocumentationSettings">
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectPlainTextFileTypeManager"> <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (eniv)" project-jdk-type="Python SDK" />
<file url="file://$PROJECT_DIR$/script/base_api/api_operation_web/big_screen_temp.py" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (GeekInterfaceTest)" project-jdk-type="Python SDK" />
</project> </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
<changelist name="Uncommitted_changes_before_Checkout_at_2021_4_14,_18_41_[Default_Changelist]" date="1618396883746" recycled="true" deleted="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_2021_4_14,_18_41_[Default_Changelist]/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Checkout at 2021/4/14, 18:41 [Default Changelist]" />
</changelist>
\ No newline at end of file
<changelist name="Uncommitted_changes_before_Checkout_at_2021_4_14,_19_04_[Default_Changelist]" date="1618398257506" recycled="false" toDelete="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_2021_4_14,_19_04_[Default_Changelist]/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Checkout at 2021/4/14, 19:04 [Default Changelist]" />
</changelist>
\ No newline at end of file
<changelist name="Uncommitted_changes_before_Checkout_at_2021_4_14,_19_04_[Default_Changelist]1" date="1618398268286" recycled="true" deleted="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_2021_4_14,_19_04_[Default_Changelist]1/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Checkout at 2021/4/14, 19:04 [Default Changelist]" />
</changelist>
\ No newline at end of file
<changelist name="Uncommitted_changes_before_Checkout_at_2021_4_14,_19_07_[Default_Changelist]" date="1618398476037" recycled="true" deleted="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_2021_4_14,_19_07_[Default_Changelist]/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Checkout at 2021/4/14, 19:07 [Default Changelist]" />
</changelist>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<changelist name="Uncommitted_changes_before_Update_at_2021_4_13,_20_21_[Default_Changelist]" date="1618316475949" recycled="true" deleted="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_2021_4_13,_20_21_[Default_Changelist]/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Update at 2021/4/13, 20:21 [Default Changelist]" />
</changelist>
\ No newline at end of file
This diff is collapsed.
...@@ -3,12 +3,12 @@ import os ...@@ -3,12 +3,12 @@ import os
if __name__ == '__main__': if __name__ == '__main__':
run_config = [ run_config = [
"-s", "./script/ji_yun_ying_pc/statistical_report/test_receipt_detail.py", "-s", "./script/ji_yun_ying_app/workbench/test_myclue.py",
"--alluredir", "./report/xml", "--alluredir", "./report/xml",
"--host", "http://192.168.32.36", "--host", "http://192.168.32.31",
"--account", "b", "--account", "A",
"--db", "36" "--db", "36"
] ]
x = pytest.main(run_config) x = pytest.main(run_config)
# os模块运行allure命令,来生成html格式的报告(根据刚刚生成的配置信息) # 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")
...@@ -7,6 +7,7 @@ from script.base_api.service_user.auth import auth_employee_post ...@@ -7,6 +7,7 @@ from script.base_api.service_user.auth import auth_employee_post
from script.defalut_account import accounts from script.defalut_account import accounts
from script.base_api.service_user.departments import departments_schools_get from script.base_api.service_user.departments import departments_schools_get
from script.base_api.service_user.wxMini import wxMini_auth_post from script.base_api.service_user.wxMini import wxMini_auth_post
from script.base_api.api_operation_app.employee import employee_login_post
def pytest_addoption(parser): def pytest_addoption(parser):
...@@ -60,6 +61,25 @@ def gos_login(pytestconfig): ...@@ -60,6 +61,25 @@ def gos_login(pytestconfig):
default_header.gos_header.setdefault("Authorization", "token not found") default_header.gos_header.setdefault("Authorization", "token not found")
@pytest.fixture(scope="session", autouse=True)
def jyy_app_login(pytestconfig):
account = accounts.get(pytestconfig.getoption('--account').upper())
jyy_app_account = account.get("jyy_app_account")
body_data = {"account": jyy_app_account.get("account"),
"password": jyy_app_account.get("password"),
"type": "employee",
"identityType": 1,
"ip": "0.0.0.0"
}
res_json = employee_login_post(body=body_data, header=default_header.jyy_app_header)
tokens = jsonpath.jsonpath(res_json, "$.data.token")
print("tokens", tokens)
if tokens:
default_header.jyy_app_header.setdefault("authorization", f"Bearer {tokens[0]}")
else:
default_header.jyy_app_header.setdefault("authorization", "token not found")
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def get_big_area_schools(): def get_big_area_schools():
res = departments_schools_get(headers=default_header.jyy_header) res = departments_schools_get(headers=default_header.jyy_header)
......
...@@ -9,7 +9,7 @@ accounts = { ...@@ -9,7 +9,7 @@ accounts = {
}, },
# 极运营app默认账号 # 极运营app默认账号
"jyy_app_account": { "jyy_app_account": {
"account": "15360956010", "account": "15244919753",
"password": "88888888" "password": "88888888"
}, },
# 家长默认账号 # 家长默认账号
......
from script.conftest import get_host, jyy_app_login
import time
import datetime
import random
import psycopg2
createSchoolAreaId = [2389, 2398, 3363, 3015, 3154, 3352, 2369, 3095, 3348, 3333, 3351, 3359, 3345, 3365, 3362, 3339,
3353, 3334, 2400, 3360, 3361, 3373, 3371, 3366, 3349, 3372, 3340, 2427, 3367, 3335, 3148, 3374,
3377, 3369, 3376, 3378, 3368, 3336, 3370, 3357, 3350, 3001, 3072, 3049, 3342, 3337, 2411, 3344,
2412, 3100, 3146, 3052, 3047, 3157, 3107, 3108, 3076, 3147, 3167, 2413, 2383, 3064, 3152, 3063,
3101, 3130, 3170, 3074, 3165, 3044, 3059, 3038, 3166, 3168, 2385, 3171, 2373, 3137, 3151, 2417,
3041, 3036, 3060, 3125, 3046, 3109, 3110, 3142, 3149, 3037, 3039, 3104, 2422, 3158, 2407, 2386,
3099, 2410, 3067, 3329, 2371, 3330, 3133, 3071, 3070, 3053, 3065, 3150, 3061, 3126, 3062, 2423,
2364, 3043, 2415, 3131, 2388, 3096, 2376, 3042, 3127, 2402, 2359, 2365, 2408, 2425, 3002, 2391,
3135, 3136, 3153, 3139, 3144, 2419, 3075, 2416, 2421, 2363, 2368, 2403, 2414, 2392, 3138, 2406,
3156, 3155, 3097, 3098, 3141, 3069, 2405, 2399, 2397, 2360, 3145, 2420, 2404, 2374, 2401, 3054,
3124]
followingStatus = ['OVERTIME', 'UNFOLLOWED', 'FOLLOWING']
def end_time():
today = datetime.date.today().strftime('%Y-%m-%d')
print(today)
return today
def start_time():
last_month = (datetime.datetime.today() + datetime.timedelta(days=-31)).strftime('%Y-%m-%d')
print(last_month)
return last_month
def generate_phone():
# 第二位数字
second = [3, 4, 5, 7, 8][random.randint(0, 4)]
# 第三位数字
third = {
3: random.randint(0, 9),
4: [5, 7, 9][random.randint(0, 2)],
5: [i for i in range(10) if i != 4][random.randint(0, 8)],
7: [i for i in range(10) if i not in [4, 9]][random.randint(0, 7)],
8: random.randint(0, 9),
}[second]
# 最后八位数字
suffix = random.randint(9999999, 100000000)
# 拼接手机号
return "1{}{}{}".format(second, third, suffix)
def generate_name():
# encoding: utf-8
first_name = ["王", "李", "张", "刘", "赵", "蒋", "孟", "陈", "徐", "杨", "沈", "马", "高", "殷", "上官", "钟", "常"]
second_name = ["伟", "华", "建国", "洋", "刚", "万里", "爱民", "牧", "陆", "路", "昕", "鑫", "兵", "硕", "志宏", "峰", "磊", "雷", "文",
"明浩", "光", "超", "军", "达", '新', '信']
name1 = random.sample(first_name, 1) + random.sample(second_name, 1)
name = ''.join(name1)
return name
def generate_intentionLevel():
Level = ['S', 'A', 'B', 'C']
intentionLevel = random.sample(Level, 1)[0]
return intentionLevel
def generate_sourceId():
ID = [111, 112, 113, 119, 101, 102, 103, 114, 115]
sourceId = random.sample(ID, 1)
return sourceId
def pg_data():
database = 'edu-admin'
user = 'dev'
password = 'mko0PL<.;?'
host = '192.168.32.31'
port = 5432
with psycopg2.connect(database=database, user=user,
password=password, host=host, port=port)as pg_conn:
with pg_conn.cursor() as cur:
cur.execute('SELECT * FROM "service_crm"."clue_basic_info" LIMIT 1')
results = cur.fetchall()
return results
lst = [{'id': 111, 'name': '网站'},
{'id': 112, 'name': '营销工具'},
{'id': 113, 'name': '公众号'},
{'id': 119, 'name': '网报小程序'},
{'id': 101, 'name': '自然口碑'},
{'id': 102, 'name': '营销活动'},
{'id': 103, 'name': '营销口碑'},
{'id': 114, 'name': '地推'},
{'id': 115, 'name': '广告'},
{'id': 116, 'name': '户外广告'}]
ids = [x.get("id") for x in lst]
\ No newline at end of file
This diff is collapsed.
import pytest import pytest
def public_assert(res_json: dict): def public_assert(res_json: object) -> object:
code = res_json.get("code", -100) code = res_json.get("code", -100)
msg = res_json.get("msg", "获取失败") msg = res_json.get("msg", "获取失败")
pytest.assume(code == 0) pytest.assume(code == 0)
pytest.assume(msg == "成功") pytest.assume(msg == "成功")
def assert_res_field_contain_value(data_list: list, value: str): def assert_res_field_contain_value(data_list: object, value: object) -> object:
if data_list: if data_list:
err_values = [x for x in data_list if value not in x] err_values = [x for x in data_list if value not in x]
if err_values: if err_values:
......
...@@ -30,4 +30,4 @@ def get_method(url, method): ...@@ -30,4 +30,4 @@ def get_method(url, method):
if __name__ == '__main__': if __name__ == '__main__':
get_method("/service-profile/app/transferred/22322/class/totalNum", "GET") get_method("/api-operation-app/employee/login", "POST")
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