Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jk_interface_test
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huangqiang
jk_interface_test
Commits
cf7d6da8
Commit
cf7d6da8
authored
Apr 14, 2021
by
huangqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码回滚
parent
74884479
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
335 additions
and
59 deletions
+335
-59
shelved.patch
...te_at_2021_4_13,_20_21_[Default_Changelist]/shelved.patch
+0
-0
Uncommitted_changes_before_Update_at_2021_4_13__20_21__Default_Changelist_.xml
...efore_Update_at_2021_4_13__20_21__Default_Changelist_.xml
+5
-0
run_method.py
common/run_method.py
+5
-0
init_base_api.py
init_base_api.py
+65
-53
init_new_base_api.py
init_new_base_api.py
+221
-0
test_receipt_detail.py
.../ji_yun_ying_pc/statistical_report/test_receipt_detail.py
+3
-6
test_login.py
script/ji_yun_ying_pc/test_login.py
+2
-0
test_order.py
script/ji_yun_ying_pc/test_order.py
+1
-0
url_to_method.py
url_to_method.py
+33
-0
No files found.
.idea/shelf/Uncommitted_changes_before_Update_at_2021_4_13,_20_21_[Default_Changelist]/shelved.patch
0 → 100644
View file @
cf7d6da8
.idea/shelf/Uncommitted_changes_before_Update_at_2021_4_13__20_21__Default_Changelist_.xml
0 → 100644
View file @
cf7d6da8
<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
common/run_method.py
View file @
cf7d6da8
...
@@ -44,6 +44,11 @@ class RunMethod:
...
@@ -44,6 +44,11 @@ class RunMethod:
except
Exception
as
e
:
except
Exception
as
e
:
res
=
{
"err_msg"
:
str
(
e
)}
res
=
{
"err_msg"
:
str
(
e
)}
# print(res)
# print(res)
import
allure
if
return_json
:
allure
.
attach
(
body
=
json
.
dumps
(
res
,
ensure_ascii
=
False
),
name
=
'响应信息'
,
attachment_type
=
allure
.
attachment_type
.
JSON
)
else
:
allure
.
attach
(
body
=
res
.
text
,
name
=
'响应信息'
,
attachment_type
=
allure
.
attachment_type
.
TEXT
)
return
res
return
res
...
...
init_base_api.py
View file @
cf7d6da8
from
common.connect_db
import
OperationDb
from
common.common_util
import
replace_string
from
common.common_util
import
replace_string
import
psycopg2
import
psycopg2
import
os
import
os
...
@@ -15,7 +14,7 @@ def query_sql(database_config, sql_str):
...
@@ -15,7 +14,7 @@ def query_sql(database_config, sql_str):
return
results
return
results
def
get_base_apis
(
is_filter
=
True
):
def
get_base_apis
():
config
=
{
config
=
{
'database'
:
'edu-admin'
,
'database'
:
'edu-admin'
,
"user"
:
'read_user'
,
"user"
:
'read_user'
,
...
@@ -32,10 +31,8 @@ def get_base_apis(is_filter=True):
...
@@ -32,10 +31,8 @@ def get_base_apis(is_filter=True):
"path_params"
:
get_path_params
(
x
[
2
]),
"path_params"
:
get_path_params
(
x
[
2
]),
"http_method"
:
x
[
3
],
"http_method"
:
x
[
3
],
"method_name"
:
x
[
2
]
.
replace
(
"{"
,
""
)
.
replace
(
"}"
,
""
)
.
replace
(
"-"
,
"_"
)
.
replace
(
"/"
,
"_"
)[
1
:]
+
"_"
+
x
[
3
]
.
lower
(),
"method_name"
:
x
[
2
]
.
replace
(
"{"
,
""
)
.
replace
(
"}"
,
""
)
.
replace
(
"-"
,
"_"
)
.
replace
(
"/"
,
"_"
)[
1
:]
+
"_"
+
x
[
3
]
.
lower
(),
"file_name"
:
x
[
2
]
.
replace
(
"-"
,
"_"
)[
1
:]
.
split
(
"/"
)[
0
]
+
"
temp
.py"
"file_name"
:
x
[
2
]
.
replace
(
"-"
,
"_"
)[
1
:]
.
split
(
"/"
)[
0
]
+
".py"
}
for
x
in
query_result
]
}
for
x
in
query_result
]
if
is_filter
:
base_apis
=
[
x
for
x
in
base_apis
if
x
.
get
(
"method_name"
)
not
in
get_current_method
()]
return
base_apis
return
base_apis
...
@@ -71,14 +68,6 @@ def create_all(base_apis: list):
...
@@ -71,14 +68,6 @@ def create_all(base_apis: list):
create_init_file
(
"script/base_api/__init__.py"
,
import_data_out
)
create_init_file
(
"script/base_api/__init__.py"
,
import_data_out
)
def
get_current_method
():
from
script
import
base_api
current_methods
=
dir
(
base_api
)
methods
=
[
"get"
,
"post"
,
"patch"
,
"head"
,
"delete"
,
"put"
]
current_methods
=
[
x
for
x
in
current_methods
if
x
.
split
(
"_"
)[
-
1
]
in
methods
]
return
current_methods
def
create_file
(
path
,
base_apis
):
def
create_file
(
path
,
base_apis
):
with
open
(
path
,
"w"
,
encoding
=
"utf-8"
)
as
file
:
with
open
(
path
,
"w"
,
encoding
=
"utf-8"
)
as
file
:
file
.
write
(
file_template
)
file
.
write
(
file_template
)
...
@@ -109,90 +98,113 @@ def create_init_file(path, import_datas):
...
@@ -109,90 +98,113 @@ def create_init_file(path, import_datas):
get_template
=
"""
get_template
=
"""
@allure.step("${name}")
def ${method_name}(${path_params}params=None, header=None, return_json=True, **kwargs):
def ${method_name}(${path_params}params=None, header=None, return_json=True, default_assert=True, **kwargs):
'''
:param: url地址后面的参数
:body: 请求体
:return_json: 是否返回json格式的响应(默认是)
:header: 请求的header
:host: 请求的环境
:return: 默认json格式的响应, return_json=False返回原始响应
'''
name = "${name}"
name = "${name}"
url = f"/${url}"
url = f"/${url}"
res = RunMethod.run_request("GET", url, params=params, header=header, return_json=return_json, name=name, **kwargs)
res = RunMethod.run_request("GET", url, params=params, header=header, return_json=return_json, name=name, **kwargs)
if return_json and default_assert:
public_assert(res)
return res
return res
"""
"""
post_template
=
"""
post_template
=
"""
@allure.step("${name}")
def ${method_name}(${path_params}params=None, body=None, header=None, return_json=True, **kwargs):
def ${method_name}(${path_params}params=None, body=None, header=None, return_json=True, default_assert=True, **kwargs):
'''
:param: url地址后面的参数
:body: 请求体
:return_json: 是否返回json格式的响应(默认是)
:header: 请求的header
:host: 请求的环境
:return: 默认json格式的响应, return_json=False返回原始响应
'''
name = "${name}"
name = "${name}"
url = f"/${url}"
url = f"/${url}"
res = RunMethod.run_request("POST", url, params=params, body=body, header=header, return_json=return_json, name=name, **kwargs)
res = RunMethod.run_request("POST", url, params=params, body=body, header=header, return_json=return_json, name=name, **kwargs)
if return_json and default_assert:
public_assert(res)
return res
return res
"""
"""
put_template
=
"""
put_template
=
"""
@allure.step("${name}")
def ${method_name}(${path_params}params=None, body=None, header=None, return_json=True, **kwargs):
def ${method_name}(${path_params}params=None, body=None, header=None, return_json=True, default_assert=True, **kwargs):
'''
:param: url地址后面的参数
:body: 请求体
:return_json: 是否返回json格式的响应(默认是)
:header: 请求的header
:host: 请求的环境
:return: 默认json格式的响应, return_json=False返回原始响应
'''
name = "${name}"
name = "${name}"
url = f"/${url}"
url = f"/${url}"
res = RunMethod.run_request("PUT", url, params=params, body=body, header=header, return_json=return_json, name=name, **kwargs)
res = RunMethod.run_request("PUT", url, params=params, body=body, header=header, return_json=return_json, name=name, **kwargs)
if return_json and default_assert:
public_assert(res)
return res
return res
"""
"""
delete_template
=
"""
delete_template
=
"""
@allure.step("${name}")
def ${method_name}(${path_params}params=None, body=None, header=None, return_json=True, **kwargs):
def ${method_name}(${path_params}params=None, body=None, header=None, return_json=True, default_assert=True, **kwargs):
'''
:param: url地址后面的参数
:body: 请求体
:return_json: 是否返回json格式的响应(默认是)
:header: 请求的header
:host: 请求的环境
:return: 默认json格式的响应, return_json=False返回原始响应
'''
name = "${name}"
name = "${name}"
url = f"/${url}"
url = f"/${url}"
res = RunMethod.run_request("DELETE", url, params=params, body=body, header=header, return_json=return_json, name=name, **kwargs)
res = RunMethod.run_request("DELETE", url, params=params, body=body, header=header, return_json=return_json, name=name, **kwargs)
if return_json and default_assert:
public_assert(res)
return res
return res
"""
"""
patch_template
=
"""
patch_template
=
"""
@allure.step("${name}")
def ${method_name}(${path_params}params=None, body=None, header=None, return_json=True, **kwargs):
def ${method_name}(${path_params}params=None, body=None, header=None, return_json=True, default_assert=True, **kwargs):
'''
:param: url地址后面的参数
:body: 请求体
:return_json: 是否返回json格式的响应(默认是)
:header: 请求的header
:host: 请求的环境
:return: 默认json格式的响应, return_json=False返回原始响应
'''
name = "${name}"
name = "${name}"
url = f"/${url}"
url = f"/${url}"
res = RunMethod.run_request("PATCH", url, params=params, body=body, header=header, return_json=return_json, name=name, **kwargs)
res = RunMethod.run_request("PATCH", url, params=params, body=body, header=header, return_json=return_json, name=name, **kwargs)
if return_json and default_assert:
public_assert(res)
return res
return res
"""
"""
head_template
=
"""
head_template
=
"""
@allure.step("${name}")
def ${method_name}(${path_params}params=None, header=None, return_json=True, **kwargs):
def ${method_name}(${path_params}params=None, header=None, return_json=True, default_assert=True, **kwargs):
'''
:param: url地址后面的参数
:body: 请求体
:return_json: 是否返回json格式的响应(默认是)
:header: 请求的header
:host: 请求的环境
:return: 默认json格式的响应, return_json=False返回原始响应
'''
name = "${name}"
name = "${name}"
url = f"/${url}"
url = f"/${url}"
res = RunMethod.run_request("HEAD", url, params=params, header=header, return_json=return_json, name=name, **kwargs)
res = RunMethod.run_request("HEAD", url, params=params, header=header, return_json=return_json, name=name, **kwargs)
if return_json and default_assert:
public_assert(res)
return res
return res
"""
"""
file_template
=
"""
file_template
=
"""
from common.run_method import RunMethod
from common.run_method import RunMethod
from script.public_asserts import public_assert
import pytest
import allure
"""
"""
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
base_apis
=
get_base_apis
()
# base_apis = get_base_apis()
print
(
"新接口"
,
base_apis
)
# create_all(base_apis)
x
=
input
(
"是否创建:"
)
pass
if
x
==
"是"
and
base_apis
:
create_all
(
base_apis
)
else
:
print
(
"取消创建"
)
init_new_base_api.py
View file @
cf7d6da8
from
common.common_util
import
replace_string
import
psycopg2
import
os
import
re
def
query_sql
(
database_config
,
sql_str
):
# 创建连接对象
with
psycopg2
.
connect
(
**
database_config
)
as
conn
:
with
conn
.
cursor
()
as
cur
:
cur
.
execute
(
sql_str
)
results
=
cur
.
fetchall
()
print
(
'查询结束'
)
return
results
def
get_base_apis
(
db_config
):
sql
=
"""SELECT name, server_name, url, http_method FROM service_user.permission WHERE type = 'URL'"""
query_result
=
query_sql
(
db_config
,
sql
)
base_apis
=
[{
"name"
:
x
[
0
],
"server_name"
:
x
[
1
]
.
replace
(
"-"
,
"_"
),
"url"
:
x
[
1
]
+
x
[
2
],
"path_params"
:
get_path_params
(
x
[
2
]),
"http_method"
:
x
[
3
],
"method_name"
:
x
[
2
]
.
replace
(
"{"
,
""
)
.
replace
(
"}"
,
""
)
.
replace
(
"-"
,
"_"
)
.
replace
(
"/"
,
"_"
)[
1
:]
+
"_"
+
x
[
3
]
.
lower
(),
"file_name"
:
x
[
2
]
.
replace
(
"-"
,
"_"
)[
1
:]
.
split
(
"/"
)[
0
]
+
".py"
}
for
x
in
query_result
]
return
base_apis
def
get_path_params
(
url
:
str
):
path_params
=
re
.
findall
(
r"{(.*?)}"
,
url
)
path_params_str
=
""
for
path_param
in
path_params
:
path_params_str
=
path_params_str
+
f
"{path_param}, "
return
path_params_str
def
create_all
(
base_apis
:
list
):
server_names
=
list
(
set
([
x
.
get
(
"server_name"
)
for
x
in
base_apis
]))
current_path
=
os
.
getcwd
()
import_data_out
=
[]
for
server_name
in
server_names
:
if
not
os
.
path
.
exists
(
"base_api_temp"
):
os
.
mkdir
(
"base_api_temp"
)
folder_path
=
os
.
path
.
join
(
current_path
,
"base_api_temp/"
+
server_name
)
folder_apis
=
[
x
for
x
in
base_apis
if
x
.
get
(
"server_name"
)
==
server_name
]
if
not
os
.
path
.
exists
(
folder_path
):
os
.
mkdir
(
folder_path
)
file_names
=
list
(
set
([
x
.
get
(
"file_name"
)
for
x
in
folder_apis
]))
init_file_path
=
os
.
path
.
join
(
folder_path
,
"__init__.py"
)
import_datas
=
[]
for
file_name
in
file_names
:
file_apis
=
[
x
for
x
in
folder_apis
if
x
.
get
(
"file_name"
)
==
file_name
]
if
file_name
==
"class.py"
:
file_name
=
"class_.py"
file_path
=
os
.
path
.
join
(
folder_path
,
file_name
)
create_file
(
file_path
,
file_apis
)
import_datas
.
append
(
f
"from script.base_api.{server_name}.{file_name.replace('.py', '')} import *"
)
create_init_file
(
init_file_path
,
import_datas
)
import_data_out
.
append
(
f
"from script.base_api.{server_name} import *"
)
create_init_file
(
"script/base_api/__init__.py"
,
import_data_out
)
def
get_current_method
():
from
script
import
base_api
current_methods
=
dir
(
base_api
)
methods
=
[
"get"
,
"post"
,
"patch"
,
"head"
,
"delete"
,
"put"
]
current_methods
=
[
x
for
x
in
current_methods
if
x
.
split
(
"_"
)[
-
1
]
in
methods
]
return
current_methods
def
create_file
(
path
,
base_apis
):
with
open
(
path
,
"w"
,
encoding
=
"utf-8"
)
as
file
:
file
.
write
(
file_template
)
for
base_api
in
base_apis
:
http_method
=
base_api
[
"http_method"
]
if
http_method
.
upper
()
==
"GET"
:
data
=
replace_string
(
get_template
,
base_api
)
elif
http_method
.
upper
()
==
"POST"
:
data
=
replace_string
(
post_template
,
base_api
)
elif
http_method
.
upper
()
==
"HEAD"
:
data
=
replace_string
(
head_template
,
base_api
)
elif
http_method
.
upper
()
==
"PUT"
:
data
=
replace_string
(
put_template
,
base_api
)
elif
http_method
.
upper
()
==
"PATCH"
:
data
=
replace_string
(
patch_template
,
base_api
)
elif
http_method
.
upper
()
==
"DELETE"
:
data
=
replace_string
(
delete_template
,
base_api
)
else
:
data
=
replace_string
(
post_template
,
base_api
)
file
.
write
(
data
)
def
create_init_file
(
path
,
import_datas
):
with
open
(
path
,
"w"
,
encoding
=
"utf-8"
)
as
file
:
for
import_data
in
import_datas
:
file
.
write
(
import_data
)
file
.
write
(
"
\r\n
"
)
get_template
=
"""
def ${method_name}(${path_params}params=None, header=None, return_json=True, **kwargs):
'''
:param: url地址后面的参数
:body: 请求体
:return_json: 是否返回json格式的响应(默认是)
:header: 请求的header
:host: 请求的环境
:return: 默认json格式的响应, return_json=False返回原始响应
'''
name = "${name}"
url = f"/${url}"
res = RunMethod.run_request("GET", url, params=params, header=header, return_json=return_json, name=name, **kwargs)
return res
"""
post_template
=
"""
def ${method_name}(${path_params}params=None, body=None, header=None, return_json=True, **kwargs):
'''
:param: url地址后面的参数
:body: 请求体
:return_json: 是否返回json格式的响应(默认是)
:header: 请求的header
:host: 请求的环境
:return: 默认json格式的响应, return_json=False返回原始响应
'''
name = "${name}"
url = f"/${url}"
res = RunMethod.run_request("POST", url, params=params, body=body, header=header, return_json=return_json, name=name, **kwargs)
return res
"""
put_template
=
"""
def ${method_name}(${path_params}params=None, body=None, header=None, return_json=True, **kwargs):
'''
:param: url地址后面的参数
:body: 请求体
:return_json: 是否返回json格式的响应(默认是)
:header: 请求的header
:host: 请求的环境
:return: 默认json格式的响应, return_json=False返回原始响应
'''
name = "${name}"
url = f"/${url}"
res = RunMethod.run_request("PUT", url, params=params, body=body, header=header, return_json=return_json, name=name, **kwargs)
return res
"""
delete_template
=
"""
def ${method_name}(${path_params}params=None, body=None, header=None, return_json=True, **kwargs):
'''
:param: url地址后面的参数
:body: 请求体
:return_json: 是否返回json格式的响应(默认是)
:header: 请求的header
:host: 请求的环境
:return: 默认json格式的响应, return_json=False返回原始响应
'''
name = "${name}"
url = f"/${url}"
res = RunMethod.run_request("DELETE", url, params=params, body=body, header=header, return_json=return_json, name=name, **kwargs)
return res
"""
patch_template
=
"""
def ${method_name}(${path_params}params=None, body=None, header=None, return_json=True, **kwargs):
'''
:param: url地址后面的参数
:body: 请求体
:return_json: 是否返回json格式的响应(默认是)
:header: 请求的header
:host: 请求的环境
:return: 默认json格式的响应, return_json=False返回原始响应
'''
name = "${name}"
url = f"/${url}"
res = RunMethod.run_request("PATCH", url, params=params, body=body, header=header, return_json=return_json, name=name, **kwargs)
return res
"""
head_template
=
"""
def ${method_name}(${path_params}params=None, header=None, return_json=True, **kwargs):
'''
:param: url地址后面的参数
:body: 请求体
:return_json: 是否返回json格式的响应(默认是)
:header: 请求的header
:host: 请求的环境
:return: 默认json格式的响应, return_json=False返回原始响应
'''
name = "${name}"
url = f"/${url}"
res = RunMethod.run_request("HEAD", url, params=params, header=header, return_json=return_json, name=name, **kwargs)
return res
"""
file_template
=
"""
from common.run_method import RunMethod
"""
if
__name__
==
'__main__'
:
db_config
=
{
'database'
:
'edu-admin'
,
"user"
:
'read_user'
,
"password"
:
'c5JJUqmtTeaSaOTN2gs7'
,
"host"
:
'132.232.15.12'
,
"port"
:
5432
}
base_apis
=
get_base_apis
(
db_config
)
base_apis
=
[
x
for
x
in
base_apis
if
x
.
get
(
"method_name"
)
not
in
get_current_method
()]
print
(
base_apis
)
create_all
(
base_apis
)
script/ji_yun_ying_pc/statistical_report/test_receipt_detail.py
View file @
cf7d6da8
...
@@ -2,20 +2,20 @@ import allure
...
@@ -2,20 +2,20 @@ import allure
import
pytest
import
pytest
import
jsonpath
import
jsonpath
from
script.base_api.service_statistics.statistics
import
statistics_advance_charge_receipt_post
from
script.base_api.service_statistics.statistics
import
statistics_advance_charge_receipt_post
from
script.base_api.service_profile.students
import
students_queryById_get
from
script.ji_yun_ying_pc.statistical_report.data_config
import
receipt_detail_data
from
script.ji_yun_ying_pc.statistical_report.data_config
import
receipt_detail_data
from
script
import
public_asserts
from
script
import
public_asserts
from
script
import
public_asserts_api
from
script
import
public_asserts_api
from
script.default_header
import
jyy_header
from
script.default_header
import
jyy_header
@allure.epic
(
"测试收据明细报表"
)
@allure.feature
(
"测试收据明细报表"
)
@allure.feature
(
"测试收据明细报表"
)
class
TestReceiptDetail
:
class
TestReceiptDetail
:
@allure.story
(
"测试收据明细列表查询-关键字筛选"
)
@allure.story
(
"测试收据明细报表"
)
@allure.step
(
"测试收据明细列表查询-关键字筛选"
)
@pytest.mark.parametrize
(
"keyword"
,
receipt_detail_data
.
keywords
)
@pytest.mark.parametrize
(
"keyword"
,
receipt_detail_data
.
keywords
)
def
test_list_search
(
self
,
keyword
):
def
test_list_search
(
self
,
keyword
):
print
(
keyword
)
keyword_value
=
keyword
.
get
(
"keyword"
)
keyword_value
=
keyword
.
get
(
"keyword"
)
body
=
{
body
=
{
"pageNum"
:
1
,
"pageNum"
:
1
,
...
@@ -28,16 +28,13 @@ class TestReceiptDetail:
...
@@ -28,16 +28,13 @@ class TestReceiptDetail:
"schoolAreaType"
:
"收费"
"schoolAreaType"
:
"收费"
}
}
res
=
statistics_advance_charge_receipt_post
(
body
=
body
,
header
=
jyy_header
)
res
=
statistics_advance_charge_receipt_post
(
body
=
body
,
header
=
jyy_header
)
print
(
res
)
keyword_type
=
keyword
.
get
(
"keyword_type"
)
keyword_type
=
keyword
.
get
(
"keyword_type"
)
if
keyword_type
==
"student_name"
:
if
keyword_type
==
"student_name"
:
student_names
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..studentName"
)
student_names
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..studentName"
)
print
(
student_names
)
result
=
public_asserts
.
assert_res_field_contain_value
(
student_names
,
keyword_value
)
result
=
public_asserts
.
assert_res_field_contain_value
(
student_names
,
keyword_value
)
pytest
.
assume
(
result
)
pytest
.
assume
(
result
)
elif
keyword_type
==
"receipt"
:
elif
keyword_type
==
"receipt"
:
receipts
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..orderNo"
)
receipts
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..orderNo"
)
print
(
receipts
)
result
=
public_asserts
.
assert_res_field_equal_value
(
receipts
,
keyword_value
)
result
=
public_asserts
.
assert_res_field_equal_value
(
receipts
,
keyword_value
)
pytest
.
assume
(
result
)
pytest
.
assume
(
result
)
else
:
else
:
...
...
script/ji_yun_ying_pc/test_login.py
View file @
cf7d6da8
...
@@ -3,6 +3,8 @@ import jsonpath
...
@@ -3,6 +3,8 @@ import jsonpath
from
script.base_api.service_user.auth
import
auth_employee_post
from
script.base_api.service_user.auth
import
auth_employee_post
from
script.base_api.service_user.employees
import
*
from
script.base_api.service_user.employees
import
*
from
script.base_api.service_user.token
import
token_valid_get
from
script.base_api.service_user.token
import
token_valid_get
import
allure
import
pytest
@allure.feature
(
"不同账号的登录测试"
)
@allure.feature
(
"不同账号的登录测试"
)
...
...
script/ji_yun_ying_pc/test_order.py
View file @
cf7d6da8
...
@@ -6,6 +6,7 @@ from script.base_api.api_operation_web import *
...
@@ -6,6 +6,7 @@ from script.base_api.api_operation_web import *
from
script.base_api.service_user.employees
import
*
from
script.base_api.service_user.employees
import
*
from
script.default_header
import
jyy_header
from
script.default_header
import
jyy_header
import
time
import
time
import
pytest
def
get_class_info
(
class_list
):
def
get_class_info
(
class_list
):
...
...
url_to_method.py
View file @
cf7d6da8
import
re
def
get_current_method
():
from
script
import
base_api
current_methods
=
dir
(
base_api
)
methods
=
[
"get"
,
"post"
,
"patch"
,
"head"
,
"delete"
,
"put"
]
current_methods
=
[
x
for
x
in
current_methods
if
x
.
split
(
"_"
)[
-
1
]
in
methods
]
return
current_methods
def
get_method_name
(
url
:
str
):
if
re
.
match
(
r".*\d+"
,
url
):
method_re
=
re
.
sub
(
r"_\d+"
,
"_.+?"
,
url
)
method_names
=
[
x
for
x
in
get_current_method
()
if
re
.
match
(
method_re
,
x
)]
if
method_names
:
return
method_names
[
0
]
else
:
return
url
else
:
return
url
def
get_method
(
url
,
method
):
server_name
,
method_name
=
url
[
1
:]
.
replace
(
"-"
,
"_"
)
.
split
(
"/"
,
1
)
file_name
=
method_name
.
split
(
"/"
)[
0
]
server_name
=
server_name
method_name
=
get_method_name
(
method_name
.
replace
(
"/"
,
"_"
)
+
"_"
+
method
.
lower
())
print
(
f
"from script.base_api.{server_name}.{file_name} import {method_name}"
)
if
__name__
==
'__main__'
:
get_method
(
"/service-profile/app/transferred/22322/class/totalNum"
,
"GET"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment