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
e734a68a
Commit
e734a68a
authored
Jun 02, 2021
by
huangqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成常规导出功能的自动化demo
parent
0df2a10a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
313 additions
and
27 deletions
+313
-27
.gitignore
.gitignore
+3
-2
workspace.xml
.idea/workspace.xml
+0
-0
run_method.cpython-37.pyc
common/__pycache__/run_method.cpython-37.pyc
+0
-0
run_method.py
common/run_method.py
+10
-2
run.py
run.py
+4
-3
public_asserts.cpython-37.pyc
script/__pycache__/public_asserts.cpython-37.pyc
+0
-0
__init__.py
script/base_api_data/service_crm/__init__.py
+0
-0
dict_data.py
script/base_api_data/service_crm/dict_data.py
+14
-0
__init__.py
script/base_api_data/service_education/__init__.py
+0
-0
education_data.py
script/base_api_data/service_education/education_data.py
+17
-0
system_data.py
script/base_api_data/service_education/system_data.py
+0
-0
__init__.py
script/download_flle/__init__.py
+0
-0
__init__.py
script/download_flle/assert_config/__init__.py
+0
-0
education_download_assert.py
.../download_flle/assert_config/education_download_assert.py
+61
-0
__init__.py
script/download_flle/data_config/__init__.py
+0
-0
suite_data.py
script/download_flle/data_config/suite_data.py
+4
-0
__init__.py
script/download_flle/jyy_download_file/__init__.py
+0
-0
test_education_download.py
...ownload_flle/jyy_download_file/test_education_download.py
+48
-0
download_file.py
script/global_data_config/download_file.py
+41
-0
global_data.py
script/global_data_config/global_data.py
+12
-2
basic_parameter_set_data.py
...ing_pc/system_set/data_config/basic_parameter_set_data.py
+44
-0
test_basic_parameter_set.py
script/ji_yun_ying_pc/system_set/test_basic_parameter_set.py
+0
-0
public_asserts.py
script/public_asserts.py
+37
-0
xin_add_class.py
..._static/xin_educational/xin_class_handle/xin_add_class.py
+3
-3
xin_delete_class.py
...atic/xin_educational/xin_class_handle/xin_delete_class.py
+1
-1
xin_update_class.py
...atic/xin_educational/xin_class_handle/xin_update_class.py
+6
-6
xin_course.py
...in_static/xin_educational/xin_course_handle/xin_course.py
+2
-2
xin_update_course.py
...ic/xin_educational/xin_course_handle/xin_update_course.py
+4
-4
xin_network.py
...t_patriarch_app/xin_static/xin_educational/xin_network.py
+1
-1
url_to_method.py
tools/url_to_method.py
+1
-1
No files found.
.gitignore
View file @
e734a68a
...
@@ -6,4 +6,5 @@ temp
...
@@ -6,4 +6,5 @@ temp
*.xml
*.xml
script/base_api
script/base_api
test/
test/
__pycache__/
__pycache__/
\ No newline at end of file
download_file_temp/
\ No newline at end of file
.idea/workspace.xml
View file @
e734a68a
This diff is collapsed.
Click to expand it.
common/__pycache__/run_method.cpython-37.pyc
View file @
e734a68a
No preview for this file type
common/run_method.py
View file @
e734a68a
...
@@ -79,9 +79,17 @@ class RunMethod:
...
@@ -79,9 +79,17 @@ class RunMethod:
request_data
=
replace_string
(
request_data_template
,
request_data_dict
)
request_data
=
replace_string
(
request_data_template
,
request_data_dict
)
allure
.
attach
(
body
=
request_data
,
name
=
'请求信息信息'
,
attachment_type
=
allure
.
attachment_type
.
TEXT
)
allure
.
attach
(
body
=
request_data
,
name
=
'请求信息信息'
,
attachment_type
=
allure
.
attachment_type
.
TEXT
)
if
return_json
:
if
return_json
:
allure
.
attach
(
body
=
json
.
dumps
(
res
,
ensure_ascii
=
False
),
name
=
'响应信息'
,
attachment_type
=
allure
.
attachment_type
.
JSON
)
attach_body
=
json
.
dumps
(
res
,
ensure_ascii
=
False
)
if
len
(
attach_body
)
>
65535
:
allure
.
attach
(
body
=
attach_body
[:
65535
],
name
=
'响应信息'
,
attachment_type
=
allure
.
attachment_type
.
TEXT
)
else
:
allure
.
attach
(
body
=
attach_body
,
name
=
'响应信息'
,
attachment_type
=
allure
.
attachment_type
.
JSON
)
else
:
else
:
allure
.
attach
(
body
=
res
.
text
,
name
=
'响应信息'
,
attachment_type
=
allure
.
attachment_type
.
TEXT
)
attach_body
=
res
.
text
if
len
(
attach_body
)
>
65535
:
allure
.
attach
(
body
=
attach_body
[:
65535
],
name
=
'响应信息'
,
attachment_type
=
allure
.
attachment_type
.
TEXT
)
else
:
allure
.
attach
(
body
=
attach_body
,
name
=
'响应信息'
,
attachment_type
=
allure
.
attachment_type
.
TEXT
)
return
res
return
res
...
...
run.py
View file @
e734a68a
...
@@ -62,12 +62,12 @@ class RunTest:
...
@@ -62,12 +62,12 @@ class RunTest:
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
case_path_list
=
[
case_path_list
=
[
"./script/
ji_yun_ying_pc/system_set/test_basic_parameter_set.py::TestGradeOpenSubject::test_grade_subject_data_paging
"
,
"./script/
download_flle/jyy_download_file/test_education_download.py
"
,
# "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_date",
# "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_date",
# "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_target",
# "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_target",
# "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_subject",
# "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_subject",
]
]
# host = "https://geek.jkwljy.com
/
"
# host = "https://geek.jkwljy.com"
# account_group = "线上"
# account_group = "线上"
host
=
"http://192.168.32.36"
host
=
"http://192.168.32.36"
account_group
=
"A"
account_group
=
"A"
...
@@ -77,7 +77,8 @@ if __name__ == '__main__':
...
@@ -77,7 +77,8 @@ if __name__ == '__main__':
# other_cmd = ['--reruns=1', '--reruns-delay=1']
# other_cmd = ['--reruns=1', '--reruns-delay=1']
other_cmd
=
[]
other_cmd
=
[]
run_obj
=
RunTest
(
case_path_list
,
host
=
host
,
account_group
=
account_group
,
db_config
=
db_config
)
run_obj
=
RunTest
(
case_path_list
,
host
=
host
,
account_group
=
account_group
,
db_config
=
db_config
)
run_obj
.
run_test
(
other_cmd
)
x
=
run_obj
.
run_test
(
other_cmd
)
print
(
x
.
value
)
# run_obj.collection_case()
# run_obj.collection_case()
run_obj
.
generate_allure_report
()
run_obj
.
generate_allure_report
()
script/__pycache__/public_asserts.cpython-37.pyc
View file @
e734a68a
No preview for this file type
script/base_api_data/service
-education
/__init__.py
→
script/base_api_data/service
_crm
/__init__.py
View file @
e734a68a
File moved
script/base_api_data/service_crm/dict_data.py
0 → 100644
View file @
e734a68a
from
script.base_api.service_crm.dict
import
dict_studentSource_query_post
from
script.default_header
import
jyy_header
class
QueryStudentSource
:
def
__init__
(
self
,
status
=
""
):
self
.
status
=
status
def
run
(
self
,
other_field
:
dict
=
{},
header
=
jyy_header
,
return_json
=
True
,
**
kwargs
):
body
=
{
**
self
.
__dict__
,
**
other_field
}
return
dict_studentSource_query_post
(
body
=
body
,
header
=
header
,
return_json
=
return_json
,
**
kwargs
)
\ No newline at end of file
script/base_api_data/service_education/__init__.py
0 → 100644
View file @
e734a68a
script/base_api_data/service_education/education_data.py
0 → 100644
View file @
e734a68a
from
script.base_api.service_education.education
import
education_classes_query_post
from
script.global_data_config.global_data
import
GlobalDataConfig
from
script.default_header
import
jyy_header
class
QueryClassList
:
def
__init__
(
self
,
courseType
=
"常规班课"
,
pageNum
=
1
,
pageSize
=
10
,
schoolAreaIds
=
None
):
self
.
courseType
=
courseType
self
.
pageNum
=
pageNum
self
.
pageSize
=
pageSize
self
.
schoolAreaIds
=
schoolAreaIds
or
GlobalDataConfig
.
get_department_id
()
def
run
(
self
,
other_field
:
dict
=
{},
header
=
jyy_header
,
return_json
=
True
,
**
kwargs
):
body
=
{
**
self
.
__dict__
,
**
other_field
}
return
education_classes_query_post
(
body
=
body
,
header
=
header
,
return_json
=
return_json
,
**
kwargs
)
\ No newline at end of file
script/base_api_data/service
-
education/system_data.py
→
script/base_api_data/service
_
education/system_data.py
View file @
e734a68a
File moved
script/download_flle/__init__.py
0 → 100644
View file @
e734a68a
script/download_flle/assert_config/__init__.py
0 → 100644
View file @
e734a68a
script/download_flle/assert_config/education_download_assert.py
0 → 100644
View file @
e734a68a
import
allure
from
pytest_assume.plugin
import
assume
import
pandas
as
pd
import
datacompy
class_field_map
=
{
"classAbbreviation"
:
"班级简称"
,
"classBeginDate_export"
:
"开班日期"
,
"classId"
:
"班级ID"
,
"className"
:
"班级名称"
,
"classStatus"
:
"状态"
,
"classTeacher"
:
"任课老师"
,
"classroom"
:
"教室"
,
"courseId"
:
"课程ID"
,
"directorName"
:
"班主任老师"
,
"directorNumber"
:
"班主任老师工号"
,
"employeeNumber"
:
"老师工号"
,
"subject"
:
"科目"
,
"targetNum"
:
"满班目标"
,
"term"
:
"学期"
,
"year"
:
"年份"
}
class_file_field
=
[
'班级简称'
,
'开班日期'
,
'班级ID'
,
'班级名称'
,
'状态'
,
'任课老师'
,
'教室'
,
'课程ID'
,
'班主任老师'
,
'班主任老师工号'
,
'老师工号'
,
'科目'
,
'满班目标'
,
'学期'
,
'年份'
]
@allure.step
(
"断言导出的excel的相同字段的数据一致"
)
def
assert_class_download_data_equal_query
(
query_list
,
download_file_path
):
download_df
=
pd
.
read_excel
(
download_file_path
)
if
query_list
:
query_df
=
pd
.
DataFrame
(
query_list
)
query_df
.
rename
(
columns
=
class_field_map
,
inplace
=
True
)
query_df
=
query_df
.
loc
[:,
class_file_field
]
query_df
.
fillna
(
"-"
,
inplace
=
True
)
query_df
=
query_df
.
astype
(
str
)
download_df
=
download_df
.
loc
[:,
class_file_field
]
download_df
=
download_df
.
astype
(
str
)
result
=
datacompy
.
Compare
(
download_df
,
query_df
,
on_index
=
True
,
df1_name
=
"下载数据"
,
df2_name
=
"查询数据"
)
assert
result
.
matches
(),
result
.
report
()
else
:
assert
download_df
.
empty
,
f
"无数据时数据应该为空,{download_df}"
@allure.step
(
"断言导出的excel与列表查询的相同字段的数据一致"
)
def
assert_class_download_data_equal_query
(
query_list
,
download_file_path
):
download_df
=
pd
.
read_excel
(
download_file_path
)
if
query_list
:
query_df
=
pd
.
DataFrame
(
query_list
)
query_df
.
rename
(
columns
=
class_field_map
,
inplace
=
True
)
query_df
=
query_df
.
loc
[:,
class_file_field
]
query_df
.
fillna
(
"-"
,
inplace
=
True
)
query_df
=
query_df
.
astype
(
str
)
download_df
=
download_df
.
loc
[:,
class_file_field
]
download_df
=
download_df
.
astype
(
str
)
result
=
datacompy
.
Compare
(
download_df
,
query_df
,
on_index
=
True
,
df1_name
=
"下载数据"
,
df2_name
=
"查询数据"
)
assert
result
.
matches
(),
result
.
report
()
else
:
assert
download_df
.
empty
,
f
"无数据时数据应该为空,{download_df}"
script/download_flle/data_config/__init__.py
0 → 100644
View file @
e734a68a
script/download_flle/data_config/suite_data.py
0 → 100644
View file @
e734a68a
from
script.global_data_config.global_data
import
GlobalDataConfig
all_school_area_id
=
GlobalDataConfig
.
get_department_id
(
is_rm_test_school
=
True
)
all_school_area_id_name_map
=
GlobalDataConfig
.
get_school_area_id_map
()
script/download_flle/jyy_download_file/__init__.py
0 → 100644
View file @
e734a68a
script/download_flle/jyy_download_file/test_education_download.py
0 → 100644
View file @
e734a68a
import
allure
from
script.base_api.service_report.export
import
export_education_class_post
from
script.global_data_config.download_file
import
download_file_by_file_id
from
script.download_flle.data_config
import
suite_data
from
script.base_api_data.service_education.education_data
import
QueryClassList
from
script.download_flle.assert_config.education_download_assert
import
*
from
script
import
public_asserts
from
script.default_header
import
jyy_header
import
os
@allure.feature
(
"测试教务班级列表导出"
)
class
TestClassDownload
:
download_file_list
=
[]
@allure.story
(
"测试班级列表导出-2021暑-年份期段筛选"
)
def
test_download_class_by_year_term
(
self
):
year
=
2023
term
=
"暑"
courseType
=
"常规班课"
schoolAreaIds
=
suite_data
.
all_school_area_id
schoolAreas
=
{
k
:
v
for
k
,
v
in
suite_data
.
all_school_area_id_name_map
.
items
()
if
k
in
schoolAreaIds
}
body
=
{
"courseType"
:
courseType
,
"year"
:
year
,
"term"
:
term
,
"schoolAreaIds"
:
schoolAreaIds
,
# 校区id与名称的映射字典字符串
"schoolAreas"
:
str
(
schoolAreas
),
}
res
=
export_education_class_post
(
body
=
body
,
header
=
jyy_header
)
public_asserts
.
public_assert
(
res
)
data
=
res
.
get
(
"data"
)
assert
data
,
f
"响应的不为空,{data}"
result
,
file_path
=
download_file_by_file_id
(
file_id
=
data
,
file_dir
=
"./download_file_temp/"
)
assert
result
,
f
"下载结果:{result}"
assert
file_path
,
f
"文件路径:{file_path}"
TestClassDownload
.
download_file_list
.
append
(
file_path
)
qct
=
QueryClassList
(
courseType
=
courseType
,
pageSize
=
100000
,
schoolAreaIds
=
schoolAreaIds
)
assert_res
=
qct
.
run
(
other_field
=
{
"year"
:
year
,
"term"
:
term
})
assert_data
=
assert_res
.
get
(
"data"
)
assert
assert_data
,
"响应的数据不为空"
assert_list
=
assert_data
.
get
(
"list"
)
# assert_class_download_data_equal_query(assert_list, file_path)
public_asserts
.
assert_download_data_equal_query
(
file_path
,
assert_list
,
download_field_map
=
class_field_map
)
def
teardown_class
(
self
):
[
os
.
remove
(
x
)
for
x
in
TestClassDownload
.
download_file_list
]
script/global_data_config/download_file.py
0 → 100644
View file @
e734a68a
import
time
import
os
from
urllib
import
request
import
urllib
import
ssl
from
script.base_api.service_report.export
import
export_queryUrl_get
from
script.default_header
import
jyy_header
ssl
.
_create_default_https_context
=
ssl
.
_create_unverified_context
def
download_file
(
url
,
file_path
):
request
.
urlretrieve
(
url
,
file_path
)
def
download_file_by_file_id
(
file_id
,
file_dir
=
"./download_file_temp/"
,
header
=
jyy_header
):
params
=
{
"id"
:
file_id
}
try
:
poll_time
=
1
is_download
=
False
file_path
=
""
while
not
is_download
and
poll_time
<=
12
:
time
.
sleep
(
5
)
res
=
export_queryUrl_get
(
params
=
params
,
header
=
header
)
file_url
=
res
.
get
(
"data"
)
if
file_url
:
file_name
=
file_url
.
rsplit
(
"/"
)[
-
1
]
file_name
=
urllib
.
parse
.
unquote
(
file_name
)
file_path
=
os
.
path
.
join
(
file_dir
,
file_name
)
request
.
urlretrieve
(
file_url
,
file_path
)
is_download
=
True
else
:
print
(
f
"第{poll_time}轮询完成,file_url:{file_url}"
)
poll_time
+=
1
return
is_download
,
file_path
except
Exception
as
e
:
return
False
,
file_path
script/global_data_config/global_data.py
View file @
e734a68a
...
@@ -74,8 +74,14 @@ class GlobalDataConfig:
...
@@ -74,8 +74,14 @@ class GlobalDataConfig:
all_class_type
=
[
*
all_class_type
,
*
v
]
all_class_type
=
[
*
all_class_type
,
*
v
]
return
all_class_type
return
all_class_type
# 获取部门ID列表
@classmethod
@classmethod
def
get_department_id
(
cls
,
department_type
=
30
,
is_rm_test_school
=
False
):
def
get_department_id
(
cls
,
department_type
=
30
,
is_rm_test_school
=
False
)
->
list
:
"""
:department_type:部门类型
:is_rm_test_school:是否剔除测试校区默认否
:return:id列表
"""
sql
=
f
"""select id from service_user.department where type = {department_type}"""
sql
=
f
"""select id from service_user.department where type = {department_type}"""
school_area_datas
=
OperationDb
.
query_sql
(
sql
)
school_area_datas
=
OperationDb
.
query_sql
(
sql
)
school_area_ids
=
[
x
[
0
]
for
x
in
school_area_datas
]
school_area_ids
=
[
x
[
0
]
for
x
in
school_area_datas
]
...
@@ -84,6 +90,7 @@ class GlobalDataConfig:
...
@@ -84,6 +90,7 @@ class GlobalDataConfig:
else
:
else
:
return
school_area_ids
return
school_area_ids
# 通过区域id获取对应校区ID列表
@staticmethod
@staticmethod
def
get_school_id_by_area_id
(
area_id
):
def
get_school_id_by_area_id
(
area_id
):
sql
=
f
"""select id from service_user.department where type = 30 and parent_id = {area_id}"""
sql
=
f
"""select id from service_user.department where type = 30 and parent_id = {area_id}"""
...
@@ -91,6 +98,7 @@ class GlobalDataConfig:
...
@@ -91,6 +98,7 @@ class GlobalDataConfig:
school_area_ids
=
[
x
[
0
]
for
x
in
school_area_datas
]
school_area_ids
=
[
x
[
0
]
for
x
in
school_area_datas
]
return
school_area_ids
return
school_area_ids
# 通过大区id获取对应校区ID列表
@staticmethod
@staticmethod
def
get_school_id_by_big_area_id
(
big_area_id
):
def
get_school_id_by_big_area_id
(
big_area_id
):
sql
=
f
"""select id from service_user.department
sql
=
f
"""select id from service_user.department
...
@@ -99,6 +107,7 @@ class GlobalDataConfig:
...
@@ -99,6 +107,7 @@ class GlobalDataConfig:
school_area_ids
=
[
x
[
0
]
for
x
in
school_area_datas
]
school_area_ids
=
[
x
[
0
]
for
x
in
school_area_datas
]
return
school_area_ids
return
school_area_ids
# 通过大区id获取对应区域ID列表
@staticmethod
@staticmethod
def
get_area_id_by_big_area_id
(
big_area_id
):
def
get_area_id_by_big_area_id
(
big_area_id
):
sql
=
f
"""select id from service_user.department where type = 40 and parent_id = {big_area_id}"""
sql
=
f
"""select id from service_user.department where type = 40 and parent_id = {big_area_id}"""
...
@@ -108,11 +117,12 @@ class GlobalDataConfig:
...
@@ -108,11 +117,12 @@ class GlobalDataConfig:
# 校区id和名称映射(40为区域名称映射)
# 校区id和名称映射(40为区域名称映射)
@staticmethod
@staticmethod
def
get_school_area_id_map
(
department_type
=
30
):
def
get_school_area_id_map
(
department_type
=
30
)
->
dict
:
sql
=
f
"""select id,name from service_user.department where type = {department_type}"""
sql
=
f
"""select id,name from service_user.department where type = {department_type}"""
school_area_datas
=
OperationDb
.
query_sql
(
sql
)
school_area_datas
=
OperationDb
.
query_sql
(
sql
)
return
{
x
[
0
]:
x
[
1
]
for
x
in
school_area_datas
}
return
{
x
[
0
]:
x
[
1
]
for
x
in
school_area_datas
}
# 部门id和短名称映射(40为区域名称映射)
@staticmethod
@staticmethod
def
get_department_short_name_map
(
department_type
=
30
):
def
get_department_short_name_map
(
department_type
=
30
):
sql
=
f
"""select id,short_name from service_user.department where type = {department_type}"""
sql
=
f
"""select id,short_name from service_user.department where type = {department_type}"""
...
...
script/ji_yun_ying_pc/system_set/data_config/basic_parameter_set_data.py
View file @
e734a68a
import
random
from
script.ji_yun_ying_pc.system_set.data_config
import
global_data
from
script.ji_yun_ying_pc.system_set.data_config
import
global_data
from
script.global_data_config.global_data
import
GlobalDataConfig
from
script.global_data_config.global_data
import
GlobalDataConfig
from
common.connect_db
import
OperationDb
school_names
=
[
"金沙"
,
"德阳"
,
"乐山春华广场中心校"
]
school_names
=
[
"金沙"
,
"德阳"
,
"乐山春华广场中心校"
]
err_school_names
=
[
"!@#$
%
^"
,
"'"
,
"ada"
]
err_school_names
=
[
"!@#$
%
^"
,
"'"
,
"ada"
]
...
@@ -116,6 +118,7 @@ def get_grade_open_subject(year, term):
...
@@ -116,6 +118,7 @@ def get_grade_open_subject(year, term):
return
open_subject_list
return
open_subject_list
# 获取可续报年级
def
get_can_continue_grade
(
year
,
term
):
def
get_can_continue_grade
(
year
,
term
):
current_open_grade_list
=
get_open_grade
(
year
,
term
)
current_open_grade_list
=
get_open_grade
(
year
,
term
)
next_year
,
next_term
=
get_next_year_term
(
year
,
term
)
next_year
,
next_term
=
get_next_year_term
(
year
,
term
)
...
@@ -135,3 +138,44 @@ def get_can_continue_grade(year, term):
...
@@ -135,3 +138,44 @@ def get_can_continue_grade(year, term):
current_open_grade
[
"can_continue_grade"
]
=
can_continue_grade
current_open_grade
[
"can_continue_grade"
]
=
can_continue_grade
return
current_open_grade_list
return
current_open_grade_list
# 获取新增退费原因数据
def
get_add_refund_reason_data
():
return
[
{
"message"
:
"自动测试新增退费原因"
+
str
(
random
.
randint
(
10000
,
99999
)),
"description"
:
1
,
},
{
"message"
:
"自动测试新增退费原因"
+
str
(
random
.
randint
(
10000
,
99999
)),
"description"
:
2
,
},
]
# 删除新增的退费原因
def
delete_refund_reason
(
refund_reason_id
):
sql
=
f
"delete from public.system_setting where type = 'refundReason' and code_id = {refund_reason_id}"
OperationDb
.
insert_update_delete_sql
(
sql
)
# 获取新增线索来源数据
def
get_add_crm_source_data
():
return
[
{
"name"
:
"自动测试新增线索来源"
+
str
(
random
.
randint
(
10000
,
99999
)),
"level_type"
:
20
,
"parentId"
:
101
},
{
"name"
:
"自动测试新增退费原因"
+
str
(
random
.
randint
(
10000
,
99999
)),
"level_type"
:
30
,
"parentId"
:
111
},
]
# 删除新增的线索来源
def
delete_crm_source
(
crm_source_id
):
sql
=
f
"delete from service_crm.student_source_dict where id = {crm_source_id}"
OperationDb
.
insert_update_delete_sql
(
sql
)
script/ji_yun_ying_pc/system_set/test_basic_parameter_set.py
View file @
e734a68a
This diff is collapsed.
Click to expand it.
script/public_asserts.py
View file @
e734a68a
...
@@ -136,3 +136,40 @@ def assert_two_list_is_intersection(res_list: list, search_list: list):
...
@@ -136,3 +136,40 @@ def assert_two_list_is_intersection(res_list: list, search_list: list):
flag
=
False
flag
=
False
return
flag
return
flag
@allure.step
(
"断言导出的excel与列表查询的相同字段的数据一致"
)
def
assert_download_data_equal_query
(
download_file_path
,
query_list
,
download_field_map
:
dict
,
fillna_values
=
"-"
,
df1_name
=
"下载数据"
,
df2_name
=
"查询数据"
,
join_columns
=
None
,
on_index
=
True
,
ignore_spaces
=
False
,
ignore_case
=
False
,
cast_column_names_lower
=
True
):
"""
download_file_path: 下载文件路径
query_list: 查询的数据列表
join_columns : 对比时连接的列(单个为字符串, 多个传入列表),排序不一样时使用
on_index : 当join_columns为none时设置为true,排序一样时使用
df1_name : 对比后的名称
df2_name : 对比后的名称
ignore_spaces : 是否忽略空格
ignore_case : 是否忽略大小写
cast_column_names_lower: 列表转小写
"""
download_df
=
pd
.
read_excel
(
download_file_path
)
if
query_list
:
query_df
=
pd
.
DataFrame
(
query_list
)
query_df
.
rename
(
columns
=
download_field_map
,
inplace
=
True
)
file_field
=
list
(
download_field_map
.
values
())
query_df
=
query_df
.
loc
[:,
file_field
]
query_df
.
fillna
(
fillna_values
,
inplace
=
True
)
query_df
=
query_df
.
astype
(
str
)
download_df
=
download_df
.
loc
[:,
file_field
]
download_df
=
download_df
.
astype
(
str
)
result
=
datacompy
.
Compare
(
download_df
,
query_df
,
join_columns
=
join_columns
,
on_index
=
on_index
,
df1_name
=
df1_name
,
df2_name
=
df2_name
,
ignore_spaces
=
ignore_spaces
,
ignore_case
=
ignore_case
,
cast_column_names_lower
=
cast_column_names_lower
)
assert
result
.
matches
(),
result
.
report
()
else
:
assert
download_df
.
empty
,
f
"无数据时数据应该为空,{download_df}"
script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_add_class.py
View file @
e734a68a
...
@@ -48,9 +48,9 @@ class CreateClass:
...
@@ -48,9 +48,9 @@ class CreateClass:
self
.
header
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
self
.
password
)
.
get_headers
()
self
.
header
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
self
.
password
)
.
get_headers
()
def
create_class
(
self
):
def
create_class
(
self
):
# class_url = '/service
-
education/education/classes/add?recommit-ticket=temp-ticket'
# class_url = '/service
_
education/education/classes/add?recommit-ticket=temp-ticket'
# course_url = '/service
-
education/education/courses/query?pageNum=1&pageSize=10'
# course_url = '/service
_
education/education/courses/query?pageNum=1&pageSize=10'
course_data
=
{
course_data
=
{
"courseName"
:
self
.
courseId
,
"courseName"
:
self
.
courseId
,
"type"
:
"click"
,
"type"
:
"click"
,
...
@@ -106,7 +106,7 @@ class CreateClass:
...
@@ -106,7 +106,7 @@ class CreateClass:
add_class_data
=
education_classes_add_post
(
params
=
'recommit-ticket=temp-ticket'
,
body
=
class_data
,
header
=
self
.
header
,
default_assert
=
False
)
add_class_data
=
education_classes_add_post
(
params
=
'recommit-ticket=temp-ticket'
,
body
=
class_data
,
header
=
self
.
header
,
default_assert
=
False
)
# add_class_data = requests.post(url=self.server + class_url, json=class_data, headers=self.header, verify=False)
# add_class_data = requests.post(url=self.server + class_url, json=class_data, headers=self.header, verify=False)
if
add_class_data
[
'code'
]
==
0
:
if
add_class_data
[
'code'
]
==
0
:
# query_url = '/service
-
education/education/classes/query'
# query_url = '/service
_
education/education/classes/query'
query_data
=
{
query_data
=
{
"pageSize"
:
30
,
"pageSize"
:
30
,
"pageNum"
:
1
,
"pageNum"
:
1
,
...
...
script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_delete_class.py
View file @
e734a68a
...
@@ -16,7 +16,7 @@ class DeleteClass:
...
@@ -16,7 +16,7 @@ class DeleteClass:
self
.
classes
=
classes
self
.
classes
=
classes
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_headers
()
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_headers
()
# self.url = '/service
-
education/education/classes/delete'
# self.url = '/service
_
education/education/classes/delete'
def
delete_class
(
self
):
def
delete_class
(
self
):
delete_msg
=
education_classes_delete_post
(
body
=
self
.
classes
,
header
=
self
.
headers
,
default_assert
=
False
)
delete_msg
=
education_classes_delete_post
(
body
=
self
.
classes
,
header
=
self
.
headers
,
default_assert
=
False
)
...
...
script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_update_class.py
View file @
e734a68a
...
@@ -17,7 +17,7 @@ class UpdateClass:
...
@@ -17,7 +17,7 @@ class UpdateClass:
self
.
body
=
{
self
.
body
=
{
"classId"
:
self
.
classId
"classId"
:
self
.
classId
}
}
# self.update_url = '/service
-
education/education/classes/optionalUpdate'
# self.update_url = '/service
_
education/education/classes/optionalUpdate'
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_headers
()
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_headers
()
...
@@ -92,7 +92,7 @@ class UpdateClass:
...
@@ -92,7 +92,7 @@ class UpdateClass:
# 修改预招收人数
# 修改预招收人数
def
update_class_studentNum
(
self
,
value
):
def
update_class_studentNum
(
self
,
value
):
# studentNum_url = '/service
-
education/education/classes/update/limit'
# studentNum_url = '/service
_
education/education/classes/update/limit'
fields
=
{
fields
=
{
'fields'
:
[
'fields'
:
[
{
{
...
@@ -104,7 +104,7 @@ class UpdateClass:
...
@@ -104,7 +104,7 @@ class UpdateClass:
# 修改满班目标
# 修改满班目标
def
update_class_targetNum
(
self
,
value
):
def
update_class_targetNum
(
self
,
value
):
# targetNum_url = '/service
-
education/education/classes/update/targetNum'
# targetNum_url = '/service
_
education/education/classes/update/targetNum'
fields
=
{
fields
=
{
'fields'
:
[
'fields'
:
[
{
{
...
@@ -116,7 +116,7 @@ class UpdateClass:
...
@@ -116,7 +116,7 @@ class UpdateClass:
# 修改班主任
# 修改班主任
def
update_class_employee
(
self
,
value
):
def
update_class_employee
(
self
,
value
):
# employee_url = '/service
-
education/classDirector/update'
# employee_url = '/service
_
education/classDirector/update'
fields
=
{
fields
=
{
"employeeId"
:
value
"employeeId"
:
value
}
}
...
@@ -124,7 +124,7 @@ class UpdateClass:
...
@@ -124,7 +124,7 @@ class UpdateClass:
# 修改是否属于外地生班
# 修改是否属于外地生班
def
update_class_outLandClass
(
self
,
value
:
bool
):
def
update_class_outLandClass
(
self
,
value
:
bool
):
outLandClass_url
=
'/service
-
education/education/classes/optionalUpdate'
outLandClass_url
=
'/service
_
education/education/classes/optionalUpdate'
fields
=
{
fields
=
{
"fields"
:
[
"fields"
:
[
{
{
...
@@ -155,7 +155,7 @@ class UpdateClass:
...
@@ -155,7 +155,7 @@ class UpdateClass:
}
}
]
]
"""
"""
# schedule_url = '/service
-
education/education/classes/update'
# schedule_url = '/service
_
education/education/classes/update'
data
=
{
data
=
{
"classSchedule"
:
classSchedule
"classSchedule"
:
classSchedule
}
}
...
...
script/xin_project_patriarch_app/xin_static/xin_educational/xin_course_handle/xin_course.py
View file @
e734a68a
...
@@ -83,7 +83,7 @@ class CreateCourse:
...
@@ -83,7 +83,7 @@ class CreateCourse:
"""
"""
def
create_course
(
self
):
def
create_course
(
self
):
# course_url = '/service
-
education/education/courses/add?recommit-ticket=temp-ticket'
# course_url = '/service
_
education/education/courses/add?recommit-ticket=temp-ticket'
course_body
=
[
course_body
=
[
{
{
"courseName"
:
self
.
courseName
+
self
.
classType
+
self
.
courseType
,
"courseName"
:
self
.
courseName
+
self
.
classType
+
self
.
courseType
,
...
@@ -122,7 +122,7 @@ class CreateCourse:
...
@@ -122,7 +122,7 @@ class CreateCourse:
course_body
[
0
][
'downhalfCoursePeriod'
]
=
self
.
downhalfCoursePeriod
course_body
[
0
][
'downhalfCoursePeriod'
]
=
self
.
downhalfCoursePeriod
course_data
=
education_courses_add_post
(
body
=
course_body
,
header
=
self
.
header
,
default_assert
=
False
)
course_data
=
education_courses_add_post
(
body
=
course_body
,
header
=
self
.
header
,
default_assert
=
False
)
if
course_data
[
'code'
]
==
0
and
course_data
[
'msg'
]
==
'成功'
:
if
course_data
[
'code'
]
==
0
and
course_data
[
'msg'
]
==
'成功'
:
# query_url = '/service
-
education/education/courses/query?pageNum=1&pageSize=10'
# query_url = '/service
_
education/education/courses/query?pageNum=1&pageSize=10'
schoolAreas
=
list
()
schoolAreas
=
list
()
if
self
.
schools
is
None
:
if
self
.
schools
is
None
:
schoolAreas
.
append
(
3052
)
schoolAreas
.
append
(
3052
)
...
...
script/xin_project_patriarch_app/xin_static/xin_educational/xin_course_handle/xin_update_course.py
View file @
e734a68a
...
@@ -10,7 +10,7 @@ def query_course(courseId, headers):
...
@@ -10,7 +10,7 @@ def query_course(courseId, headers):
:param courseId: 课程ID
:param courseId: 课程ID
:return:
:return:
"""
"""
# query_url = '/service
-
education/education/courses/queryById'
# query_url = '/service
_
education/education/courses/queryById'
query_data
=
{
query_data
=
{
"courseId"
:
courseId
,
"courseId"
:
courseId
,
"judgeUsed"
:
True
,
"judgeUsed"
:
True
,
...
@@ -72,7 +72,7 @@ class UpdateCourse:
...
@@ -72,7 +72,7 @@ class UpdateCourse:
self
.
uphalfCoursePeriod
=
uphalfCoursePeriod
self
.
uphalfCoursePeriod
=
uphalfCoursePeriod
self
.
downhalfCoursePeriod
=
downhalfCoursePeriod
self
.
downhalfCoursePeriod
=
downhalfCoursePeriod
self
.
update_url
=
'/service
-
education/education/update/course/class'
self
.
update_url
=
'/service
_
education/education/update/course/class'
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_headers
()
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_headers
()
...
@@ -127,7 +127,7 @@ class UpdateCoursePrice:
...
@@ -127,7 +127,7 @@ class UpdateCoursePrice:
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
self
.
password
)
.
get_headers
()
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
self
.
password
)
.
get_headers
()
# self.update_price_url = '/service
-
education/education/courses/modifyPrice'
# self.update_price_url = '/service
_
education/education/courses/modifyPrice'
def
update_course_price
(
self
):
def
update_course_price
(
self
):
course_data
=
query_course
(
courseId
=
self
.
courseId
,
headers
=
self
.
headers
)
course_data
=
query_course
(
courseId
=
self
.
courseId
,
headers
=
self
.
headers
)
...
@@ -170,7 +170,7 @@ class UpdateCourseSchool:
...
@@ -170,7 +170,7 @@ class UpdateCourseSchool:
self
.
username
=
username
self
.
username
=
username
self
.
password
=
password
self
.
password
=
password
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
self
.
password
)
.
get_headers
()
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
self
.
password
)
.
get_headers
()
self
.
update_school_url
=
'/service
-
education/education/courses/courseArea'
self
.
update_school_url
=
'/service
_
education/education/courses/courseArea'
self
.
update_body
=
{
self
.
update_body
=
{
"courseId"
:
self
.
courseId
,
"courseId"
:
self
.
courseId
,
"schools"
:
self
.
schools
"schools"
:
self
.
schools
...
...
script/xin_project_patriarch_app/xin_static/xin_educational/xin_network.py
View file @
e734a68a
...
@@ -54,7 +54,7 @@ class NetWork:
...
@@ -54,7 +54,7 @@ class NetWork:
"classSignEndDate"
:
self
.
classSignEndDate
,
"classSignEndDate"
:
self
.
classSignEndDate
,
"classResignBeginDate"
:
self
.
classResignBeginDate
,
"classResignBeginDate"
:
self
.
classResignBeginDate
,
"classResignEndDate"
:
self
.
classResignEndDate
}
"classResignEndDate"
:
self
.
classResignEndDate
}
# network_url = '/service
-
education/education/classes/update/resignClassInfo'
# network_url = '/service
_
education/education/classes/update/resignClassInfo'
network_data
=
education_classes_update_resignClassInfo_post
(
body
=
data
,
header
=
self
.
headers
,
default_assert
=
False
)
network_data
=
education_classes_update_resignClassInfo_post
(
body
=
data
,
header
=
self
.
headers
,
default_assert
=
False
)
return
network_data
return
network_data
...
...
tools/url_to_method.py
View file @
e734a68a
...
@@ -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-education/
system/setting/querySystemSettings
"
,
"post"
)
get_method
(
"/service-education/
education/classes/query
"
,
"post"
)
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