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
48a25d80
Commit
48a25d80
authored
May 10, 2021
by
lanjiali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
校区费用预警
parent
a0875ccb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
465 additions
and
171 deletions
+465
-171
workspace.xml
.idea/workspace.xml
+10
-4
run.py
run.py
+1
-1
test_demo.py
script/ji_yun_ying_pc/lanjiali_report/test_demo.py
+198
-166
test_school_expense.py
script/ji_yun_ying_pc/lanjiali_report/test_school_expense.py
+256
-0
No files found.
.idea/workspace.xml
View file @
48a25d80
...
...
@@ -20,11 +20,10 @@
</component>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"54f4d37d-1724-4813-a1e2-24e200088c5f"
name=
"Default Changelist"
comment=
"校区收入查询"
>
<change
afterPath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_school_expense.py"
afterDir=
"false"
/>
<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/ji_yun_ying_pc/lanjiali_report/data_config/report_config.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/data_config/report_config.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_school_income.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_school_income.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_student_income.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_student_income.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_demo.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_demo.py"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
...
...
@@ -284,7 +283,14 @@
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1620385172857
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"14"
/>
<task
id=
"LOCAL-00014"
summary=
"校区收入查询"
>
<created>
1620468346117
</created>
<option
name=
"number"
value=
"00014"
/>
<option
name=
"presentableId"
value=
"LOCAL-00014"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1620468346117
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"15"
/>
<servers
/>
</component>
<component
name=
"Vcs.Log.Tabs.Properties"
>
...
...
run.py
View file @
48a25d80
...
...
@@ -3,7 +3,7 @@ import os
if
__name__
==
'__main__'
:
run_config
=
[
"-s"
,
"./script/ji_yun_ying_pc/lanjiali_report/test_s
tudent_income.py::Test_student_income::test_diffient_studentincome
"
,
"-s"
,
"./script/ji_yun_ying_pc/lanjiali_report/test_s
chool_expense.py
"
,
"--alluredir"
,
"./report/xml"
,
"--host"
,
"http://192.168.32.31"
,
"--account"
,
"b"
,
...
...
script/ji_yun_ying_pc/lanjiali_report/test_demo.py
View file @
48a25d80
...
...
@@ -33,21 +33,25 @@ class Test_select_student_expense:
"term"
:
"春"
,
"schoolAreaIds"
:
school_areas
}
res
=
report_finance_student_expense_warning_post
(
body
=
data
,
header
=
jyy_header
)
if
keyword_type
==
"studentName"
:
student_names
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..studentName"
)
result
=
public_asserts
.
assert_res_field_contain_value
(
student_names
,
keyword_value
)
pytest
.
assume
(
result
)
elif
keyword_type
==
'studentNo'
:
student_NO
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..studentNo"
)
result
=
public_asserts
.
assert_res_field_equal_value
(
student_NO
,
keyword_value
)
pytest
.
assume
(
result
)
elif
keyword_type
==
"phone"
:
student_no
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..studentNo"
)
# 调用查询返回的学生no下的学生手机号
studentphone_list
=
select_student_phone
(
student_no
)
result
=
public_asserts
.
assert_res_field_equal_value
(
studentphone_list
,
keyword_value
)
pytest
.
assume
(
result
)
res
=
report_finance_student_expense_warning_post
(
body
=
data
,
header
=
jyy_header
)
if
res
[
'data'
][
'list'
]
==
[]:
assert
res
[
'msg'
]
==
'成功'
assert
res
[
'code'
]
==
0
else
:
if
keyword_type
==
"studentName"
:
student_names
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..studentName"
)
result
=
public_asserts
.
assert_res_field_contain_value
(
student_names
,
keyword_value
)
pytest
.
assume
(
result
)
elif
keyword_type
==
'studentNo'
:
student_NO
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..studentNo"
)
result
=
public_asserts
.
assert_res_field_equal_value
(
student_NO
,
keyword_value
)
pytest
.
assume
(
result
)
elif
keyword_type
==
"phone"
:
student_no
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..studentNo"
)
# 调用查询返回的学生no下的学生手机号
studentphone_list
=
select_student_phone
(
student_no
)
result
=
public_asserts
.
assert_res_field_equal_value
(
studentphone_list
,
keyword_value
)
pytest
.
assume
(
result
)
@allure.story
(
"学生费用预警查询-不同年份筛选"
)
@pytest.mark.parametrize
(
"year"
,
select_years
())
...
...
@@ -57,14 +61,18 @@ class Test_select_student_expense:
"pageSize"
:
10
,
"studentStatuses"
:
[
1110
],
"year"
:
year
,
"keyword"
:
'
蓝
'
,
"keyword"
:
''
,
"term"
:
"春"
,
"schoolAreaIds"
:
school_areas
"schoolAreaIds"
:
school_areas
[
0
:
50
]
}
res
=
report_finance_student_expense_warning_post
(
header
=
jyy_header
,
body
=
data
)
years
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..year"
)
result
=
public_asserts
.
assert_res_field_equal_value
(
years
,
year
)
pytest
.
assume
(
result
)
if
res
[
'data'
][
'list'
]
==
[]:
assert
res
[
'msg'
]
==
'成功'
assert
res
[
'code'
]
==
0
else
:
years
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..year"
)
result
=
public_asserts
.
assert_res_field_equal_value
(
years
,
year
)
pytest
.
assume
(
result
)
@allure.story
(
'学生费用预警-期段筛选'
)
@pytest.mark.parametrize
(
"term"
,[
select_term
()])
...
...
@@ -79,9 +87,13 @@ class Test_select_student_expense:
"schoolAreaIds"
:
school_areas
}
res
=
report_finance_student_expense_warning_post
(
header
=
jyy_header
,
body
=
data
)
terms
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..term"
)
result
=
public_asserts
.
assert_res_field_equal_value
(
terms
,
term
)
pytest
.
assume
(
result
)
if
res
[
'data'
][
'list'
]
==
[]:
assert
res
[
'msg'
]
==
'成功'
assert
res
[
'code'
]
==
0
else
:
terms
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..term"
)
result
=
public_asserts
.
assert_res_field_equal_value
(
terms
,
term
)
pytest
.
assume
(
result
)
@allure.story
(
"学生费用预警-学生状态筛选"
)
@pytest.mark.parametrize
(
"statuses"
,
student_statuses
)
...
...
@@ -98,19 +110,23 @@ class Test_select_student_expense:
"schoolAreaIds"
:
school_areas
}
res
=
report_finance_student_expense_warning_post
(
header
=
jyy_header
,
body
=
data
)
student_status
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..studentStatus"
)
if
status_meaning
==
'在读学员'
:
result
=
public_asserts
.
assert_res_field_in_list
(
student_status
,
status_value
)
pytest
.
assume
(
result
)
elif
status_meaning
==
'结业学员'
:
result
=
public_asserts
.
assert_res_field_in_list
(
student_status
,
status_value
)
pytest
.
assume
(
result
)
elif
status_meaning
==
'出班学员'
:
result
=
public_asserts
.
assert_res_field_in_list
(
student_status
,
status_value
)
pytest
.
assume
(
result
)
elif
status_meaning
==
'全部学员'
:
result
=
public_asserts
.
assert_res_field_in_list
(
student_status
,
status_value
)
pytest
.
assume
(
result
)
if
res
[
'data'
][
'list'
]
==
[]:
assert
res
[
'msg'
]
==
'成功'
assert
res
[
'code'
]
==
0
else
:
student_status
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..studentStatus"
)
if
status_meaning
==
'在读学员'
:
result
=
public_asserts
.
assert_res_field_in_list
(
student_status
,
status_value
)
pytest
.
assume
(
result
)
elif
status_meaning
==
'结业学员'
:
result
=
public_asserts
.
assert_res_field_in_list
(
student_status
,
status_value
)
pytest
.
assume
(
result
)
elif
status_meaning
==
'出班学员'
:
result
=
public_asserts
.
assert_res_field_in_list
(
student_status
,
status_value
)
pytest
.
assume
(
result
)
elif
status_meaning
==
'全部学员'
:
result
=
public_asserts
.
assert_res_field_in_list
(
student_status
,
status_value
)
pytest
.
assume
(
result
)
@allure.story
(
'学生费用预警-年级筛选'
)
@pytest.mark.parametrize
(
"grade"
,
grades
)
...
...
@@ -125,21 +141,25 @@ class Test_select_student_expense:
"grades"
:
[
grade
]
}
res
=
report_finance_student_expense_warning_post
(
header
=
jyy_header
,
body
=
data
)
grade_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..grade"
)
if
grade
==
'一年级'
:
result
=
public_asserts
.
assert_res_field_equal_value
(
grade_list
,
'1年级'
)
pytest
.
assume
(
result
)
elif
grade
==
'二年级'
:
result
=
public_asserts
.
assert_res_field_equal_value
(
grade_list
,
'2年级'
)
pytest
.
assume
(
result
)
elif
grade
==
'三年级'
:
result
=
public_asserts
.
assert_res_field_equal_value
(
grade_list
,
'3年级'
)
pytest
.
assume
(
result
)
elif
grade
==
'四年级'
:
result
=
public_asserts
.
assert_res_field_equal_value
(
grade_list
,
'4年级'
)
pytest
.
assume
(
result
)
@allure.title
(
'学生费用预警-学科筛选'
)
if
res
[
'data'
][
'list'
]
==
[]:
assert
res
[
'msg'
]
==
'成功'
assert
res
[
'code'
]
==
0
else
:
grade_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..grade"
)
if
grade
==
'一年级'
:
result
=
public_asserts
.
assert_res_field_equal_value
(
grade_list
,
'1年级'
)
pytest
.
assume
(
result
)
elif
grade
==
'二年级'
:
result
=
public_asserts
.
assert_res_field_equal_value
(
grade_list
,
'2年级'
)
pytest
.
assume
(
result
)
elif
grade
==
'三年级'
:
result
=
public_asserts
.
assert_res_field_equal_value
(
grade_list
,
'3年级'
)
pytest
.
assume
(
result
)
elif
grade
==
'四年级'
:
result
=
public_asserts
.
assert_res_field_equal_value
(
grade_list
,
'4年级'
)
pytest
.
assume
(
result
)
@allure.story
(
'学生费用预警-学科筛选'
)
@pytest.mark.parametrize
(
"subject"
,
subjects
)
def
test_select_subject
(
self
,
subject
):
data
=
{
...
...
@@ -153,22 +173,26 @@ class Test_select_student_expense:
"subjects"
:
[
subject
]
}
res
=
report_finance_student_expense_warning_post
(
header
=
jyy_header
,
body
=
data
)
subject_list
=
jsonpath
.
jsonpath
(
res
,
'$.data.list..subject'
)
if
subject
==
'语文'
:
result
=
public_asserts
.
assert_res_field_equal_value
(
subject_list
,
subject
)
pytest
.
assume
(
result
)
elif
subject
==
'英语'
:
result
=
public_asserts
.
assert_res_field_equal_value
(
subject_list
,
subject
)
pytest
.
assume
(
result
)
elif
subject
==
'物理'
:
result
=
public_asserts
.
assert_res_field_equal_value
(
subject_list
,
subject
)
pytest
.
assume
(
result
)
elif
subject
==
'数学'
:
result
=
public_asserts
.
assert_res_field_equal_value
(
subject_list
,
subject
)
pytest
.
assume
(
result
)
elif
subject
==
'化学'
:
result
=
public_asserts
.
assert_res_field_equal_value
(
subject_list
,
subject
)
pytest
.
assume
(
result
)
if
res
[
'data'
][
'list'
]
==
[]:
assert
res
[
'msg'
]
==
'成功'
assert
res
[
'code'
]
==
0
else
:
subject_list
=
jsonpath
.
jsonpath
(
res
,
'$.data.list..subject'
)
if
subject
==
'语文'
:
result
=
public_asserts
.
assert_res_field_equal_value
(
subject_list
,
subject
)
pytest
.
assume
(
result
)
elif
subject
==
'英语'
:
result
=
public_asserts
.
assert_res_field_equal_value
(
subject_list
,
subject
)
pytest
.
assume
(
result
)
elif
subject
==
'物理'
:
result
=
public_asserts
.
assert_res_field_equal_value
(
subject_list
,
subject
)
pytest
.
assume
(
result
)
elif
subject
==
'数学'
:
result
=
public_asserts
.
assert_res_field_equal_value
(
subject_list
,
subject
)
pytest
.
assume
(
result
)
elif
subject
==
'化学'
:
result
=
public_asserts
.
assert_res_field_equal_value
(
subject_list
,
subject
)
pytest
.
assume
(
result
)
@allure.story
(
"学生费用预警-班型筛选"
)
@pytest.mark.parametrize
(
"class_types"
,
classTypes
)
...
...
@@ -187,22 +211,26 @@ class Test_select_student_expense:
"schoolAreaIds"
:
school_areas
}
res
=
report_finance_student_expense_warning_post
(
header
=
jyy_header
,
body
=
data
)
class_type_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..classType"
)
if
classtype_name
==
'常规班课'
:
result
=
public_asserts
.
assert_res_field_in_list
(
class_type_list
,
class_types_value
)
pytest
.
assume
(
result
)
elif
classtype_name
==
'精品定制课'
:
result
=
public_asserts
.
assert_res_field_in_list
(
class_type_list
,
class_types_value
)
pytest
.
assume
(
result
)
elif
classtype_name
==
'集训班课'
:
result
=
public_asserts
.
assert_res_field_in_list
(
class_type_list
,
class_types_value
)
pytest
.
assume
(
result
)
elif
classtype_name
==
'专题班课'
:
result
=
public_asserts
.
assert_res_field_in_list
(
class_type_list
,
class_types_value
)
pytest
.
assume
(
result
)
elif
classtype_name
==
'服务班课'
:
result
=
public_asserts
.
assert_res_field_in_list
(
class_type_list
,
class_types_value
)
pytest
.
assume
(
result
)
if
res
[
'data'
][
'list'
]
==
[]:
assert
res
[
'msg'
]
==
'成功'
assert
res
[
'code'
]
==
0
else
:
class_type_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..classType"
)
if
classtype_name
==
'常规班课'
:
result
=
public_asserts
.
assert_res_field_in_list
(
class_type_list
,
class_types_value
)
pytest
.
assume
(
result
)
elif
classtype_name
==
'精品定制课'
:
result
=
public_asserts
.
assert_res_field_in_list
(
class_type_list
,
class_types_value
)
pytest
.
assume
(
result
)
elif
classtype_name
==
'集训班课'
:
result
=
public_asserts
.
assert_res_field_in_list
(
class_type_list
,
class_types_value
)
pytest
.
assume
(
result
)
elif
classtype_name
==
'专题班课'
:
result
=
public_asserts
.
assert_res_field_in_list
(
class_type_list
,
class_types_value
)
pytest
.
assume
(
result
)
elif
classtype_name
==
'服务班课'
:
result
=
public_asserts
.
assert_res_field_in_list
(
class_type_list
,
class_types_value
)
pytest
.
assume
(
result
)
@allure.story
(
"学生费用预警-组合筛选"
)
...
...
@@ -267,87 +295,91 @@ class Test_select_student_expense:
"schoolAreaIds"
:
school_areas
}
res
=
report_finance_student_expense_warning_post
(
header
=
jyy_header
,
body
=
data
)
#获取返回的学生预收课时数,判断与接口返回的计算结果一致
total_prepaidNum
=
jsonpath
.
jsonpath
(
res
,
"$.data.extend.prepaidNum"
)
student_prepaidNum_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..prepaidNum"
)
sum_prepaidNum
=
round
(
sum
(
student_prepaidNum_list
),
2
)
if
total_prepaidNum
[
0
]
!=
sum_prepaidNum
:
print
(
"计算的预收课程净额与接口返回的预收课程净额不相等"
)
else
:
assert
round
(
total_prepaidNum
[
0
],
2
)
==
sum_prepaidNum
#预收课程净额总计
total_prepaidAmount
=
jsonpath
.
jsonpath
(
res
,
"$.data.extend.prepaidAmount"
)
prepaidAmount_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..prepaidAmount"
)
sum_prepaidAmount
=
round
(
sum
(
prepaidAmount_list
),
2
)
if
total_prepaidAmount
[
0
]
!=
sum_prepaidAmount
:
print
(
"计算的预收课程净额与接口返回的预收课程净额不相等"
)
else
:
assert
round
(
total_prepaidAmount
[
0
],
2
)
==
sum_prepaidAmount
#课消课时数总计
total_attendanceNum
=
jsonpath
.
jsonpath
(
res
,
"$.data.extend.attendanceNum"
)
attendanceNum_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..attendanceNum"
)
sum_attendanceNum
=
round
(
sum
(
attendanceNum_list
),
2
)
if
total_attendanceNum
[
0
]
!=
sum_attendanceNum
:
print
(
"计算的课消课时总数与接口返回的课消课时数不相等"
)
else
:
assert
round
(
total_attendanceNum
[
0
],
2
)
==
sum_attendanceNum
#溢价总计
total_premium
=
jsonpath
.
jsonpath
(
res
,
"$.data.extend.premium"
)
premium_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..premium"
)
sum_premium
=
round
(
sum
(
premium_list
),
2
)
if
total_premium
[
0
]
!=
sum_premium
:
print
(
"计算的溢价与接口返回的溢价不相等"
)
else
:
assert
round
(
total_premium
[
0
],
2
)
==
sum_premium
#其他抵扣总计
total_otherDeduction
=
jsonpath
.
jsonpath
(
res
,
"$.data.extend.otherDeduction"
)
otherDeduction_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..otherDeduction"
)
sum_otherDeduction
=
round
(
sum
(
otherDeduction_list
),
2
)
assert
sum_otherDeduction
==
round
(
total_otherDeduction
[
0
],
2
)
#差异调整总计
total_imbalanceAmount
=
jsonpath
.
jsonpath
(
res
,
"$.data.extend.imbalanceAmount"
)
imbalanceAmount_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..imbalanceAmount"
)
sum_imbalanceAmount
=
round
(
sum
(
imbalanceAmount_list
),
2
)
if
total_imbalanceAmount
[
0
]
!=
sum_imbalanceAmount
:
print
(
"计算的差异调整与接口返回的差异调整不相等"
)
else
:
assert
round
(
total_imbalanceAmount
[
0
],
2
)
==
sum_imbalanceAmount
#课消金额总计
total_attendanceAmount
=
jsonpath
.
jsonpath
(
res
,
"$.data.extend.attendanceAmount"
)
attendanceAmount_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..attendanceAmount"
)
sum_attendanceAmount
=
round
(
sum
(
attendanceAmount_list
),
2
)
if
total_attendanceAmount
[
0
]
!=
sum_attendanceAmount
:
print
(
"计算的课消金额与接口返回的课消金额不相等"
)
else
:
assert
round
(
total_attendanceAmount
[
0
],
2
)
==
sum_attendanceAmount
#剩余课时数总计
total_remainNum
=
jsonpath
.
jsonpath
(
res
,
"$.data.extend.remainNum"
)
remainNum_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..remainNum"
)
sum_remainNum
=
round
(
sum
(
remainNum_list
),
2
)
if
total_remainNum
[
0
]
!=
sum_remainNum
:
print
(
"计算的剩余课时数与接口返回的剩余课时数不相等"
)
if
res
[
'data'
][
'list'
]
==
[]:
assert
res
[
'msg'
]
==
'成功'
assert
res
[
'code'
]
==
0
else
:
assert
round
(
total_remainNum
[
0
],
2
)
==
sum_remainNum
#剩余课程金额总计
total_remainAmount
=
jsonpath
.
jsonpath
(
res
,
"$.data.extend.remainAmount"
)
remainAmount_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..remainAmount"
)
sum_remainAmount
=
round
(
sum
(
remainAmount_list
),
2
)
if
total_remainAmount
[
0
]
!=
sum_remainAmount
:
print
(
"计算的剩余课程金额与接口返回的剩余课程金额不相等"
)
else
:
assert
round
(
total_remainAmount
[
0
],
2
)
==
sum_remainAmount
#获取返回的学生预收课时数,判断与接口返回的计算结果一致
total_prepaidNum
=
jsonpath
.
jsonpath
(
res
,
"$.data.extend.prepaidNum"
)
student_prepaidNum_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..prepaidNum"
)
sum_prepaidNum
=
round
(
sum
(
student_prepaidNum_list
),
2
)
if
total_prepaidNum
[
0
]
!=
sum_prepaidNum
:
print
(
"计算的预收课程净额与接口返回的预收课程净额不相等"
)
else
:
assert
round
(
total_prepaidNum
[
0
],
2
)
==
sum_prepaidNum
#预收课程净额总计
total_prepaidAmount
=
jsonpath
.
jsonpath
(
res
,
"$.data.extend.prepaidAmount"
)
prepaidAmount_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..prepaidAmount"
)
sum_prepaidAmount
=
round
(
sum
(
prepaidAmount_list
),
2
)
if
total_prepaidAmount
[
0
]
!=
sum_prepaidAmount
:
print
(
"计算的预收课程净额与接口返回的预收课程净额不相等"
)
else
:
assert
round
(
total_prepaidAmount
[
0
],
2
)
==
sum_prepaidAmount
#课消课时数总计
total_attendanceNum
=
jsonpath
.
jsonpath
(
res
,
"$.data.extend.attendanceNum"
)
attendanceNum_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..attendanceNum"
)
sum_attendanceNum
=
round
(
sum
(
attendanceNum_list
),
2
)
if
total_attendanceNum
[
0
]
!=
sum_attendanceNum
:
print
(
"计算的课消课时总数与接口返回的课消课时数不相等"
)
else
:
assert
round
(
total_attendanceNum
[
0
],
2
)
==
sum_attendanceNum
#溢价总计
total_premium
=
jsonpath
.
jsonpath
(
res
,
"$.data.extend.premium"
)
premium_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..premium"
)
sum_premium
=
round
(
sum
(
premium_list
),
2
)
if
total_premium
[
0
]
!=
sum_premium
:
print
(
"计算的溢价与接口返回的溢价不相等"
)
else
:
assert
round
(
total_premium
[
0
],
2
)
==
sum_premium
#其他抵扣总计
total_otherDeduction
=
jsonpath
.
jsonpath
(
res
,
"$.data.extend.otherDeduction"
)
otherDeduction_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..otherDeduction"
)
sum_otherDeduction
=
round
(
sum
(
otherDeduction_list
),
2
)
assert
sum_otherDeduction
==
round
(
total_otherDeduction
[
0
],
2
)
#差异调整总计
total_imbalanceAmount
=
jsonpath
.
jsonpath
(
res
,
"$.data.extend.imbalanceAmount"
)
imbalanceAmount_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..imbalanceAmount"
)
sum_imbalanceAmount
=
round
(
sum
(
imbalanceAmount_list
),
2
)
if
total_imbalanceAmount
[
0
]
!=
sum_imbalanceAmount
:
print
(
"计算的差异调整与接口返回的差异调整不相等"
)
else
:
assert
round
(
total_imbalanceAmount
[
0
],
2
)
==
sum_imbalanceAmount
#课消金额总计
total_attendanceAmount
=
jsonpath
.
jsonpath
(
res
,
"$.data.extend.attendanceAmount"
)
attendanceAmount_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..attendanceAmount"
)
sum_attendanceAmount
=
round
(
sum
(
attendanceAmount_list
),
2
)
if
total_attendanceAmount
[
0
]
!=
sum_attendanceAmount
:
print
(
"计算的课消金额与接口返回的课消金额不相等"
)
else
:
assert
round
(
total_attendanceAmount
[
0
],
2
)
==
sum_attendanceAmount
#剩余课时数总计
total_remainNum
=
jsonpath
.
jsonpath
(
res
,
"$.data.extend.remainNum"
)
remainNum_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..remainNum"
)
sum_remainNum
=
round
(
sum
(
remainNum_list
),
2
)
if
total_remainNum
[
0
]
!=
sum_remainNum
:
print
(
"计算的剩余课时数与接口返回的剩余课时数不相等"
)
else
:
assert
round
(
total_remainNum
[
0
],
2
)
==
sum_remainNum
#剩余课程金额总计
total_remainAmount
=
jsonpath
.
jsonpath
(
res
,
"$.data.extend.remainAmount"
)
remainAmount_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..remainAmount"
)
sum_remainAmount
=
round
(
sum
(
remainAmount_list
),
2
)
if
total_remainAmount
[
0
]
!=
sum_remainAmount
:
print
(
"计算的剩余课程金额与接口返回的剩余课程金额不相等"
)
else
:
assert
round
(
total_remainAmount
[
0
],
2
)
==
sum_remainAmount
@allure.story
(
"学生费用预警-查看学生信息"
)
...
...
@@ -379,9 +411,9 @@ class Test_select_student_expense:
"pageSize"
:
10
,
"studentStatuses"
:
[
1110
],
"year"
:
select_year
(),
"keyword"
:
'
蓝
'
,
"keyword"
:
''
,
"term"
:
select_term
(),
"schoolAreaIds"
:
school_areas
"schoolAreaIds"
:
school_areas
[
0
:
20
]
}
res
=
report_finance_student_expense_warning_post
(
header
=
jyy_header
,
body
=
data
)
studentexpense_total
=
res
[
'data'
][
'total'
]
...
...
@@ -394,9 +426,9 @@ class Test_select_student_expense:
"pageSize"
:
10
,
"studentStatuses"
:
[
1110
],
"year"
:
select_year
(),
"keyword"
:
'
蓝
'
,
"keyword"
:
''
,
"term"
:
select_term
(),
"schoolAreaIds"
:
school_areas
"schoolAreaIds"
:
school_areas
[
0
:
20
]
}
res_page2
=
report_finance_student_expense_warning_post
(
header
=
jyy_header
,
body
=
data2
)
assert
res_page2
[
'msg'
]
==
'成功'
...
...
script/ji_yun_ying_pc/lanjiali_report/test_school_expense.py
0 → 100644
View file @
48a25d80
# 校区费用预警
import
allure
import
pytest
import
jsonpath
from
script
import
public_asserts
from
script.base_api
import
report_finance_school_expense_warning_post
,
report_finance_student_expense_warning_post
from
script.ji_yun_ying_pc.lanjiali_report.data_config.report_config
import
*
from
script.default_header
import
jyy_header
@allure.feature
(
"预警报表-校区费用预警查询"
)
class
Test_select_school_expense_warning
():
@allure.story
(
"校区费用预警-按年份筛选"
)
@pytest.mark.parametrize
(
"year"
,[
select_year
()])
def
test_select_year
(
self
,
year
):
print
(
year
)
data
=
{
"pageNum"
:
1
,
"pageSize"
:
10
,
"year"
:
year
,
"term"
:
"春"
,
"schoolAreaIds"
:
school_areas
,
"groups"
:
[
"school_area_id"
]
}
res
=
report_finance_school_expense_warning_post
(
header
=
jyy_header
,
body
=
data
)
assert
res
[
'msg'
]
==
'成功'
assert
res
[
'code'
]
==
0
@allure.story
(
"校区费用预警-按期段筛选"
)
@pytest.mark.parametrize
(
"term"
,[
select_term
()])
def
test_select_term
(
self
,
term
):
data
=
{
"pageNum"
:
1
,
"pageSize"
:
10
,
"year"
:
select_year
(),
"term"
:
term
,
"schoolAreaIds"
:
school_areas
,
"groups"
:
[
"school_area_id"
]
}
res
=
report_finance_school_expense_warning_post
(
header
=
jyy_header
,
body
=
data
)
assert
res
[
'msg'
]
==
'成功'
assert
res
[
'code'
]
==
0
@allure.story
(
"校区费用预警-组合筛选"
)
@pytest.mark.parametrize
(
'year,term,grade,subject,classtype'
,
[
(
select_year
(),
select_term
(),
grades
[
2
],
subjects
[
3
],
'极趣班'
)
]
)
def
test_select_all
(
self
,
year
,
term
,
grade
,
subject
,
classtype
):
data
=
{
"pageNum"
:
1
,
"pageSize"
:
10
,
"year"
:
year
,
"term"
:
term
,
"subjects"
:
[
subject
],
"grades"
:
[
grade
],
"classTypes"
:
[
classtype
],
"schoolAreaIds"
:
school_areas
,
"groups"
:
[
"school_area_id"
]
}
res
=
report_finance_school_expense_warning_post
(
header
=
jyy_header
,
body
=
data
)
assert
res
[
'msg'
]
==
'成功'
assert
res
[
'code'
]
==
0
@allure.story
(
"校区费用预警-汇总数据校验"
)
@pytest.mark.parametrize
(
"year,term,subject,grade,classtype"
,
[(
select_year
(),
select_term
(),
subjects
[
4
],
grades
[
2
],
"数学"
)]
)
def
test_schoolExtend_total
(
self
,
year
,
term
,
subject
,
grade
,
classtype
):
data
=
{
"pageNum"
:
1
,
"pageSize"
:
10
,
"year"
:
year
,
"term"
:
term
,
"subjects"
:
[
subject
],
"grades"
:
[
grade
],
"classTypes"
:
[
classtype
],
"schoolAreaIds"
:
school_areas
,
"groups"
:
[
"school_area_id"
]
}
schoolexpense_res
=
report_finance_school_expense_warning_post
(
header
=
jyy_header
,
body
=
data
)
#获取学生费用预警汇总数据
student_expense_data
=
{
"pageNum"
:
1
,
"pageSize"
:
10000
,
"year"
:
year
,
"term"
:
term
,
"subjects"
:
[
subject
],
"grades"
:
[
grade
],
"classTypes"
:
[
classtype
],
"schoolAreaIds"
:
school_areas
,
"studentStatuses"
:
[
1110
,
1140
,
1150
,
1120
,
1130
,
1160
]
}
studentexpense_res
=
report_finance_student_expense_warning_post
(
header
=
jyy_header
,
body
=
student_expense_data
)
if
schoolexpense_res
[
'data'
][
'list'
]
!=
[]:
#校区汇总的预收课时总数与学生预收课时总数判断
school_prepaidNum_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'prepaidNum'
],
2
)
student_prepaidNum_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'prepaidNum'
],
2
)
assert
school_prepaidNum_total
==
student_prepaidNum_total
print
(
school_prepaidNum_total
)
#校区汇总的预收课程净额
school_prepaidAmount_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'prepaidAmount'
],
2
)
student_prepaidAmount_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'prepaidAmount'
],
2
)
assert
school_prepaidAmount_total
==
student_prepaidAmount_total
print
(
school_prepaidAmount_total
)
#校区汇总的课消课时数
school_attendanceNum_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'attendanceNum'
],
2
)
student_attendanceNum_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'attendanceNum'
],
2
)
assert
school_attendanceNum_total
==
student_attendanceNum_total
print
(
school_attendanceNum_total
)
#校区汇总的溢价
school_premium_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'premium'
],
2
)
student_premium_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'premium'
],
2
)
print
(
school_premium_total
)
assert
school_premium_total
==
student_premium_total
#校区汇总的其他抵扣
school_otherDeduction_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'otherDeduction'
],
2
)
student_otherDeduction_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'otherDeduction'
],
2
)
print
(
school_otherDeduction_total
)
assert
school_otherDeduction_total
==
student_otherDeduction_total
#校区差异调整汇总 imbalanceAmount
school_imbalanceAmount_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'imbalanceAmount'
],
2
)
student_imbalanceAmount_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'imbalanceAmount'
],
2
)
assert
school_imbalanceAmount_total
==
student_imbalanceAmount_total
print
(
school_imbalanceAmount_total
)
else
:
assert
schoolexpense_res
[
'msg'
]
==
'成功'
assert
schoolexpense_res
[
'code'
]
==
0
@allure.story
(
"校区费用预警-不同校区的列表数据正确"
)
@pytest.mark.parametrize
(
#[2389]:成都金沙中心校 [3063]:创意山中心校
"year,term,subject,grade,classtype,schoolarea"
,
[
(
select_year
(),
select_term
(),
subjects
[
3
],
grades
[
2
],
"极趣班"
,[
2389
]),
(
select_year
(),
select_term
(),
subjects
[
3
],
grades
[
2
],
"极趣班"
,
[
3063
])
]
)
def
test_diffient_schoolexpense_total
(
self
,
year
,
term
,
subject
,
grade
,
classtype
,
schoolarea
):
print
(
grade
,
subject
)
schoolexpense_data
=
{
"pageNum"
:
1
,
"pageSize"
:
10
,
"year"
:
year
,
"term"
:
term
,
"subjects"
:
[
subject
],
"grades"
:
[
grade
],
"classTypes"
:
[
classtype
],
"schoolAreaIds"
:
schoolarea
,
"groups"
:
[
"school_area_id"
]
}
schoolexpense_res
=
report_finance_school_expense_warning_post
(
header
=
jyy_header
,
body
=
schoolexpense_data
)
#获取对应校区学生的费用预警总额
studentexpense_data
=
{
"pageNum"
:
1
,
"pageSize"
:
10000
,
"year"
:
year
,
"term"
:
term
,
"subjects"
:
[
subject
],
"grades"
:
[
grade
],
"classTypes"
:
[
classtype
],
"schoolAreaIds"
:
schoolarea
,
"studentStatuses"
:
[
1110
,
1140
,
1150
,
1120
,
1130
,
1160
]
}
studentexpense_res
=
report_finance_student_expense_warning_post
(
header
=
jyy_header
,
body
=
studentexpense_data
)
if
schoolexpense_res
[
'data'
][
'list'
]
==
[]:
assert
schoolexpense_res
[
'code'
]
==
0
assert
schoolexpense_res
[
'msg'
]
==
'成功'
else
:
# 校区汇总的预收课时总数与学生预收课时总数判断
school_prepaidNum_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'prepaidNum'
],
2
)
student_prepaidNum_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'prepaidNum'
],
2
)
assert
school_prepaidNum_total
==
student_prepaidNum_total
# 校区汇总的预收课程净额
school_prepaidAmount_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'prepaidAmount'
],
2
)
student_prepaidAmount_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'prepaidAmount'
],
2
)
assert
school_prepaidAmount_total
==
student_prepaidAmount_total
# 校区汇总的课消课时数
school_attendanceNum_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'attendanceNum'
],
2
)
student_attendanceNum_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'attendanceNum'
],
2
)
assert
school_attendanceNum_total
==
student_attendanceNum_total
# 校区汇总的溢价
school_premium_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'premium'
],
2
)
student_premium_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'premium'
],
2
)
assert
school_premium_total
==
student_premium_total
# 校区汇总的其他抵扣
school_otherDeduction_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'otherDeduction'
],
2
)
student_otherDeduction_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'otherDeduction'
],
2
)
assert
school_otherDeduction_total
==
student_otherDeduction_total
# 校区差异调整汇总 imbalanceAmount
school_imbalanceAmount_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'imbalanceAmount'
],
2
)
student_imbalanceAmount_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'imbalanceAmount'
],
2
)
assert
school_imbalanceAmount_total
==
student_imbalanceAmount_total
@allure.story
(
"校区费用预警-分页"
)
@pytest.mark.parametrize
(
"year,term,subject,grade,classtype"
,
[(
select_year
(),
select_term
(),
subjects
[
3
],
grades
[
2
],
"极趣班"
)]
)
def
test_page
(
self
,
year
,
term
,
subject
,
grade
,
classtype
):
data
=
{
"pageNum"
:
1
,
"pageSize"
:
10
,
"year"
:
year
,
"term"
:
term
,
"subjects"
:
[
subject
],
"grades"
:
[
grade
],
"classTypes"
:
[
classtype
],
"schoolAreaIds"
:
school_areas
,
"groups"
:
[
"school_area_id"
]
}
res1
=
report_finance_school_expense_warning_post
(
header
=
jyy_header
,
body
=
data
)
schoolexpense_total
=
res1
[
'data'
][
'total'
]
if
schoolexpense_total
<=
10
:
assert
res1
[
'msg'
]
==
'成功'
assert
res1
[
'data'
][
'pageNum'
]
==
1
else
:
data2
=
{
"pageNum"
:
2
,
"pageSize"
:
10
,
"year"
:
year
,
"term"
:
term
,
"subjects"
:
[
subject
],
"grades"
:
[
grade
],
"classTypes"
:
[
classtype
],
"schoolAreaIds"
:
school_areas
,
"groups"
:
[
"school_area_id"
]
}
res2
=
report_finance_school_expense_warning_post
(
header
=
jyy_header
,
body
=
data2
)
assert
res2
[
'msg'
]
==
'成功'
assert
res2
[
'data'
][
'pageNum'
]
==
2
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