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
09e47033
Commit
09e47033
authored
May 11, 2021
by
小刘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加到购课单
parent
d762bafd
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
420 additions
and
18 deletions
+420
-18
test_auth_choose_class_details.py
...p/test_xin_choose_class/test_auth_choose_class_details.py
+43
-1
test_auth_add_purchase.py
...rch_app/test_xin_purchase_class/test_auth_add_purchase.py
+261
-0
test_auth_remove_purchase.py
..._app/test_xin_purchase_class/test_auth_remove_purchase.py
+5
-0
test_auth_update_puchase.py
...h_app/test_xin_purchase_class/test_auth_update_puchase.py
+0
-0
test_auth_update_purchase.py
..._app/test_xin_purchase_class/test_auth_update_purchase.py
+5
-0
test_show_puchase.py
...atriarch_app/test_xin_purchase_class/test_show_puchase.py
+0
-0
test_show_purchase.py
...triarch_app/test_xin_purchase_class/test_show_purchase.py
+5
-0
__init__.py
...ic/xin_choose_class/xin_add_class_to_purchase/__init__.py
+0
-0
xin_class_add_to_purchase.py
...ss/xin_add_class_to_purchase/xin_class_add_to_purchase.py
+32
-0
xin_change_list_index.py
...patriach_static/xin_public_class/xin_change_list_index.py
+10
-0
xin_global_static.py
...xin_patriach_static/xin_public_class/xin_global_static.py
+3
-0
xin_student.py
...n_project_patriarch_app/xin_static/xin_crm/xin_student.py
+0
-1
xin_add_class.py
..._static/xin_educational/xin_class_handle/xin_add_class.py
+2
-2
xin_course.py
...in_static/xin_educational/xin_course_handle/xin_course.py
+0
-3
xin_update_course.py
...ic/xin_educational/xin_course_handle/xin_update_course.py
+28
-1
xin_school.py
...roject_patriarch_app/xin_static/xin_setting/xin_school.py
+26
-10
No files found.
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_choose_class/test_auth_choose_class_details.py
View file @
09e47033
import
datetime
import
time
from
datetime
import
timedelta
import
allure
from
pytest_assume.plugin
import
assume
...
...
@@ -13,6 +13,7 @@ from script.xin_project_patriarch_app.xin_static.xin_educational.xin_class_handl
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_class_handle.xin_update_class
import
UpdateClass
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_course_handle.xin_course
import
CreateCourse
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_network
import
NetWork
from
script.xin_project_patriarch_app.xin_static.xin_setting
import
School
from
script.xin_project_patriarch_app.xin_static.xin_time
import
Time_get
...
...
@@ -180,3 +181,44 @@ class TestAuthChoseClassDetails:
with
assume
:
assert
details_data
.
get
(
'data'
)
.
get
(
'teacherDetail'
)
.
get
(
'subject'
)
==
'数学'
with
assume
:
assert
details_data
.
get
(
'data'
)
.
get
(
'teacherDetail'
)
.
get
(
'sex'
)
==
'男'
with
assume
:
assert
'测试成都校区'
in
details_data
.
get
(
'data'
)
.
get
(
'teacherDetail'
)
.
get
(
'schoolArea'
)
@allure.story
(
'选课列表-班级详情'
)
@allure.title
(
'验证上下分段的班级只能买上,排课显示正确'
)
@allure.description
(
'验证上下分段的班级只能买上,排课显示正确'
)
def
test_subsection_top_class_time
(
self
):
# 获取当前时间后两天为分段上的结束时间
start_time
=
datetime
.
datetime
.
now
()
+
timedelta
(
days
=
2
)
# 获取当前时间后七天的时间作为下的结束时间
end_time
=
datetime
.
datetime
.
now
()
+
timedelta
(
days
=
2
)
# 格式化成后端接受的参数
start_time
=
start_time
.
strftime
(
"
%
Y/
%
m/
%
d"
)
+
' 23:59:59'
end_time
=
end_time
.
strftime
(
"
%
Y/
%
m/
%
d"
)
+
' 23:59:59'
sectionValue
=
[
{
"term"
:
StaticGlobal
.
TERM
,
"upRegisterDeadline"
:
start_time
,
"registerDeadline"
:
end_time
}
]
# 修改校区为分段
School
(
body
=
School
.
param
(
sectionValue
=
sectionValue
),
server
=
self
.
server
)
.
school_update
()
@allure.story
(
'选课列表-班级详情'
)
@allure.title
(
'验证上下分段的班级上下一起买,排课显示正确'
)
@allure.description
(
'验证上下分段的班级上下一起买,排课显示正确'
)
def
test_subsection_bottom_class_time
(
self
):
pass
@allure.story
(
'选课列表-班级详情'
)
@allure.title
(
'验证上下分段的班级只能买上,金额显示正确'
)
@allure.description
(
'验证上下分段的班级只能买上,金额显示正确'
)
def
test_subsection_top_class_price
(
self
):
pass
@allure.story
(
'选课列表-班级详情'
)
@allure.title
(
'验证上下分段的班级上下一起买,金额显示正确'
)
@allure.description
(
'验证上下分段的班级上下一起买,金额显示正确'
)
def
test_subsection_bottom_class_price
(
self
):
pass
@allure.story
(
'选课列表-班级详情'
)
@allure.title
(
'删除班级,查看班级详情'
)
@allure.description
(
'删除班级,查看班级详情'
)
def
test_delete_class_and_query_class
(
self
):
pass
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_purchase_class/test_auth_add_purchase.py
View file @
09e47033
"""
@encoding: utf-8
@Author: LiuHangXin
@Time: 2021/5/6
"""
import
datetime
import
time
import
allure
from
pytest_assume.plugin
import
assume
from
script.base_api
import
app_purchaseOrder_getPurchaseOrderList_get
from
script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_choose_class.xin_add_class_to_purchase.xin_class_add_to_purchase
import
AddClassToPurchase
from
script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_public_class.xin_change_list_index
import
ChangeListIndex
from
script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_public_class.xin_global_static
import
StaticGlobal
from
script.xin_project_patriarch_app.xin_static.xin_crm.xin_apply.xin_pay_order
import
PayOrder
from
script.xin_project_patriarch_app.xin_static.xin_crm.xin_apply.xin_save_order
import
SaveOrder
from
script.xin_project_patriarch_app.xin_static.xin_crm.xin_student
import
CreateStudent
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_class_handle.xin_add_class
import
CreateClass
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_class_handle.xin_delete_class
import
DeleteClass
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_course_handle.xin_course
import
CreateCourse
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_course_handle.xin_update_course
import
StopOrStartCourse
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_network
import
NetWork
from
script.xin_project_patriarch_app.xin_static.xin_time
import
Time_get
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_patriarch_login
import
AuthHeaders
"""
加入购课单
"""
@allure.epic
(
'家长APP接口自动化测试'
)
@allure.feature
(
'加入购课单'
)
class
TestAuthAddClassToPurchase
:
def
setup_class
(
self
):
self
.
server
=
StaticGlobal
.
SERVER
self
.
schoolArea
=
StaticGlobal
.
SCHOOL
# 新建一个学生
self
.
studentPho
=
'189'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
d
%
H
%
M
%
S'
)
students_data
=
CreateStudent
(
server
=
self
.
server
,
contactInfo
=
self
.
studentPho
)
.
create_student
()
self
.
userId
=
students_data
[
'data'
][
'list'
][
0
][
'studentId'
]
self
.
header
=
AuthHeaders
(
server
=
self
.
server
,
username
=
self
.
studentPho
)
.
get_auth_headers
()
@allure.story
(
'加入购课单'
)
@allure.title
(
'加入副线班到购课单'
)
@allure.description
(
'验证加入副线班到购课单成功'
)
def
test_auth_add_to_purchase
(
self
):
course_id
=
CreateCourse
(
server
=
self
.
server
,
classType
=
'专题'
,
courseType
=
'专题班课'
,
productType
=
'副线课程'
,
year
=
StaticGlobal
.
YEAR
,
term
=
StaticGlobal
.
TERM
)
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
class_id
=
CreateClass
(
server
=
self
.
server
,
courseId
=
course_id
,
schoolArea
=
self
.
schoolArea
)
.
create_class
()[
'classId'
]
NetWork
(
server
=
self
.
server
,
resignClassIds
=
[
class_id
])
.
network_set
()
# 添加到购课单
purchase_msg
=
AddClassToPurchase
(
server
=
self
.
server
,
classId
=
class_id
,
header
=
self
.
header
,
studentId
=
self
.
userId
)
.
class_add_to_purchase
()
with
assume
:
assert
purchase_msg
.
get
(
'code'
)
==
0
with
assume
:
assert
purchase_msg
.
get
(
'msg'
)
==
'成功'
with
assume
:
assert
purchase_msg
.
get
(
'data'
)
.
get
(
'result'
)
==
0
with
assume
:
assert
purchase_msg
.
get
(
'data'
)
.
get
(
'msg'
)
==
'OK'
purchase_order_list
=
app_purchaseOrder_getPurchaseOrderList_get
(
params
=
{
'studentId'
:
self
.
userId
},
header
=
self
.
header
)
assert_data
=
ChangeListIndex
()
.
change_list_index
(
purchase_order_list
.
get
(
'data'
),
'classId'
,
class_id
)
with
assume
:
assert
purchase_order_list
.
get
(
'code'
)
==
0
with
assume
:
assert
purchase_order_list
.
get
(
'msg'
)
==
'成功'
with
assume
:
assert
assert_data
.
get
(
'classId'
)
==
class_id
with
assume
:
assert
assert_data
.
get
(
'classType'
)
==
'专题'
with
assume
:
assert
assert_data
.
get
(
'courseId'
)
==
course_id
@allure.story
(
'加入购课单'
)
@allure.title
(
'不上架,直接加入新生班到购课单'
)
@allure.description
(
'新生班不上架,直接加入新生班到购课单'
)
def
test_auth_not_network_add_purchase
(
self
):
course_id
=
CreateCourse
(
server
=
self
.
server
,
productType
=
'主线课程'
,
classType
=
'新生'
,
courseType
=
'常规班课'
,
year
=
StaticGlobal
.
YEAR
,
term
=
StaticGlobal
.
TERM
)
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
class_id
=
CreateClass
(
server
=
self
.
server
,
courseId
=
course_id
,
schoolArea
=
self
.
schoolArea
)
.
create_class
()[
'classId'
]
purchase_msg
=
AddClassToPurchase
(
server
=
self
.
server
,
classId
=
class_id
,
header
=
self
.
header
,
studentId
=
self
.
userId
)
.
class_add_to_purchase
()
with
assume
:
assert
purchase_msg
.
get
(
'code'
)
==
0
with
assume
:
assert
purchase_msg
.
get
(
'msg'
)
==
'成功'
with
assume
:
assert
purchase_msg
.
get
(
'data'
)
.
get
(
'result'
)
==
0
with
assume
:
assert
purchase_msg
.
get
(
'data'
)
.
get
(
'msg'
)
==
'OK'
purchase_order_list
=
app_purchaseOrder_getPurchaseOrderList_get
(
params
=
{
'studentId'
:
self
.
userId
},
header
=
self
.
header
)
assert_data
=
ChangeListIndex
()
.
change_list_index
(
purchase_order_list
.
get
(
'data'
),
'classId'
,
class_id
)
with
assume
:
assert
purchase_order_list
.
get
(
'code'
)
==
0
with
assume
:
assert
purchase_order_list
.
get
(
'msg'
)
==
'成功'
with
assume
:
assert
assert_data
.
get
(
'classId'
)
==
class_id
with
assume
:
assert
assert_data
.
get
(
'classType'
)
==
'新生'
with
assume
:
assert
assert_data
.
get
(
'courseId'
)
==
course_id
@allure.story
(
'加入购课单'
)
@allure.title
(
'不上架,直接加入极趣班到购课单'
)
@allure.description
(
'新生班不上架,直接加入极趣班到购课单'
)
def
test_auth_not_network_add_purchase
(
self
):
course_id
=
CreateCourse
(
server
=
self
.
server
,
productType
=
'主线课程'
,
classType
=
'极趣班'
,
courseType
=
'常规班课'
,
year
=
StaticGlobal
.
YEAR
,
term
=
StaticGlobal
.
TERM
)
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
class_id
=
CreateClass
(
server
=
self
.
server
,
courseId
=
course_id
,
schoolArea
=
self
.
schoolArea
)
.
create_class
()[
'classId'
]
purchase_msg
=
AddClassToPurchase
(
server
=
self
.
server
,
classId
=
class_id
,
header
=
self
.
header
,
studentId
=
self
.
userId
)
.
class_add_to_purchase
()
with
assume
:
assert
purchase_msg
.
get
(
'code'
)
==
0
with
assume
:
assert
purchase_msg
.
get
(
'msg'
)
==
'成功'
with
assume
:
assert
purchase_msg
.
get
(
'data'
)
.
get
(
'result'
)
==
0
with
assume
:
assert
purchase_msg
.
get
(
'data'
)
.
get
(
'msg'
)
==
'OK'
purchase_order_list
=
app_purchaseOrder_getPurchaseOrderList_get
(
params
=
{
'studentId'
:
self
.
userId
},
header
=
self
.
header
)
assert_data
=
ChangeListIndex
()
.
change_list_index
(
purchase_order_list
.
get
(
'data'
),
'classId'
,
class_id
)
with
assume
:
assert
purchase_order_list
.
get
(
'code'
)
==
0
with
assume
:
assert
purchase_order_list
.
get
(
'msg'
)
==
'成功'
with
assume
:
assert
assert_data
.
get
(
'classId'
)
==
class_id
with
assume
:
assert
assert_data
.
get
(
'classType'
)
==
'极趣班'
with
assume
:
assert
assert_data
.
get
(
'courseId'
)
==
course_id
@allure.story
(
'加入购课单'
)
@allure.title
(
'班级已经满员,加入购课单'
)
@allure.description
(
'班级已经满员,加入购课单'
)
def
test_full_class_add_purchase
(
self
):
# 新建一个学生报班,让班级满员
studentPho_two
=
'189'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
d
%
H
%
M
%
S'
)
students_data_two
=
CreateStudent
(
server
=
self
.
server
,
contactInfo
=
studentPho_two
)
.
create_student
()
userId_two
=
students_data_two
[
'data'
][
'list'
][
0
][
'studentId'
]
# header_two = AuthHeaders(server=self.server, username=self.studentPho).get_auth_headers()
# 新建一个班级
course_id
=
CreateCourse
(
server
=
self
.
server
,
productType
=
'主线课程'
,
classType
=
'极趣班'
,
courseType
=
'常规班课'
,
year
=
StaticGlobal
.
YEAR
,
term
=
StaticGlobal
.
TERM
,
courseNumber
=
1
,
totalPrice
=
10
)
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
class_id
=
CreateClass
(
server
=
self
.
server
,
courseId
=
course_id
,
schoolArea
=
self
.
schoolArea
,
classStudentNum
=
1
)
.
create_class
()[
'classId'
]
# 让新建的学生购买这个班级
order_id
=
SaveOrder
(
server
=
self
.
server
,
studentId
=
userId_two
,
amount
=
10
,
details
=
[{
"classId"
:
class_id
,
"num"
:
10
,
"discountId"
:
""
,
"category"
:
"CLASS"
}])
.
save_order
()[
'data'
]
PayOrder
(
server
=
self
.
server
,
orderId
=
order_id
,
payInfos
=
[
{
"payChannel"
:
"CASH"
,
"payAmount"
:
10
}
])
.
pay_order
()
time
.
sleep
(
2
)
purchase_msg
=
AddClassToPurchase
(
server
=
self
.
server
,
classId
=
class_id
,
header
=
self
.
header
,
studentId
=
self
.
userId
)
.
class_add_to_purchase
()
with
assume
:
assert
purchase_msg
.
get
(
'code'
)
==
0
@allure.story
(
'加入购课单'
)
@allure.title
(
'已经加入购课单,再加入'
)
@allure.description
(
'已经加入购课单,再加入,不能加入购课单'
)
def
test_already_add_class_add_purchase
(
self
):
course_id
=
CreateCourse
(
server
=
self
.
server
,
classType
=
'主线课程'
,
courseType
=
'新生'
,
productType
=
'常规班课'
,
year
=
StaticGlobal
.
YEAR
,
term
=
StaticGlobal
.
TERM
)
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
class_id
=
CreateClass
(
server
=
self
.
server
,
courseId
=
course_id
,
schoolArea
=
self
.
schoolArea
)
.
create_class
()[
'classId'
]
NetWork
(
server
=
self
.
server
,
resignClassIds
=
[
class_id
])
.
network_set
()
# 第一次加入购课单
purchase_msg
=
AddClassToPurchase
(
server
=
self
.
server
,
classId
=
class_id
,
header
=
self
.
header
,
studentId
=
self
.
userId
)
.
class_add_to_purchase
()
with
assume
:
assert
purchase_msg
.
get
(
'code'
)
==
0
with
assume
:
assert
purchase_msg
.
get
(
'msg'
)
==
'成功'
with
assume
:
assert
purchase_msg
.
get
(
'data'
)
.
get
(
'result'
)
==
0
with
assume
:
assert
purchase_msg
.
get
(
'data'
)
.
get
(
'msg'
)
==
'OK'
# 再次加入购课单
double_add_purchase
=
AddClassToPurchase
(
server
=
self
.
server
,
classId
=
class_id
,
header
=
self
.
header
,
studentId
=
self
.
userId
)
.
class_add_to_purchase
()
with
assume
:
assert
double_add_purchase
.
get
(
'code'
)
==
-
1
with
assume
:
assert
double_add_purchase
.
get
(
'msg'
)
==
'该班级已在您的购课单中'
@allure.story
(
'加入购课单'
)
@allure.title
(
'删除班级,加入购课单'
)
@allure.description
(
'删除班级,加入购课单,不能加入'
)
def
test_delete_class_add_purchase
(
self
):
course_id
=
CreateCourse
(
server
=
self
.
server
,
classType
=
'主线课程'
,
courseType
=
'新生'
,
productType
=
'常规班课'
,
year
=
StaticGlobal
.
YEAR
,
term
=
StaticGlobal
.
TERM
)
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
class_id
=
CreateClass
(
server
=
self
.
server
,
courseId
=
course_id
,
schoolArea
=
self
.
schoolArea
)
.
create_class
()[
'classId'
]
# 删除该班级
DeleteClass
(
server
=
self
.
server
,
classes
=
[
class_id
])
.
delete_class
()
purchase_msg
=
AddClassToPurchase
(
server
=
self
.
server
,
classId
=
class_id
,
header
=
self
.
header
,
studentId
=
self
.
userId
)
.
class_add_to_purchase
()
"""
按理说删除的班级应该不能加入购课单,但是现有逻辑可以加入购课单
"""
with
assume
:
assert
purchase_msg
.
get
(
'code'
)
==
0
with
assume
:
assert
purchase_msg
.
get
(
'msg'
)
==
'成功'
with
assume
:
assert
purchase_msg
.
get
(
'data'
)
.
get
(
'result'
)
==
0
with
assume
:
assert
purchase_msg
.
get
(
'data'
)
.
get
(
'msg'
)
==
'OK'
@allure.story
(
'加入购课单'
)
@allure.title
(
'停用班级绑定的课程,加入购课单'
)
@allure.description
(
'停用班级绑定的课程,加入购课单,能加入'
)
def
test_stop_course_add_purchase
(
self
):
course_id
=
CreateCourse
(
server
=
self
.
server
,
classType
=
'主线课程'
,
courseType
=
'新生'
,
productType
=
'常规班课'
,
year
=
StaticGlobal
.
YEAR
,
term
=
StaticGlobal
.
TERM
)
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
class_id
=
CreateClass
(
server
=
self
.
server
,
courseId
=
course_id
,
schoolArea
=
self
.
schoolArea
)
.
create_class
()[
'classId'
]
# 停用课程
update_course_data
=
StopOrStartCourse
(
server
=
self
.
server
,
course_data
=
[{
"courseId"
:
course_id
,
"courseStatus"
:
2
}])
.
stop_or_start_course
()
with
assume
:
assert
update_course_data
.
get
(
'code'
)
==
0
with
assume
:
assert
update_course_data
.
get
(
'msg'
)
==
'成功'
with
assume
:
assert
update_course_data
.
get
(
'data'
)
is
True
# 加入购课单
purchase_msg
=
AddClassToPurchase
(
server
=
self
.
server
,
classId
=
class_id
,
header
=
self
.
header
,
studentId
=
self
.
userId
)
.
class_add_to_purchase
()
with
assume
:
assert
purchase_msg
.
get
(
'code'
)
==
0
with
assume
:
assert
purchase_msg
.
get
(
'msg'
)
==
'成功'
with
assume
:
assert
purchase_msg
.
get
(
'data'
)
.
get
(
'result'
)
==
0
with
assume
:
assert
purchase_msg
.
get
(
'data'
)
.
get
(
'msg'
)
==
'OK'
@allure.story
(
'加入购课单'
)
@allure.title
(
'班级过了网报时间,加入购课单'
)
@allure.description
(
'班级过了网报时间,加入购课单'
)
def
test_after_network_add_purchase
(
self
):
course_id
=
CreateCourse
(
server
=
self
.
server
,
classType
=
'专题'
,
courseType
=
'专题班课'
,
productType
=
'副线课程'
,
year
=
StaticGlobal
.
YEAR
,
term
=
StaticGlobal
.
TERM
)
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
class_id
=
CreateClass
(
server
=
self
.
server
,
courseId
=
course_id
,
schoolArea
=
self
.
schoolArea
)
.
create_class
()[
'classId'
]
# 设置网报时间已经结束
NetWork
(
server
=
self
.
server
,
resignClassIds
=
[
class_id
],
classSaleBeginDate
=
Time_get
.
get_after_month_time_start
(
second
=
True
),
classSaleEndDate
=
Time_get
.
get_after_month_time_end
(
second
=
True
))
.
network_set
()
# 加入购课单
purchase_msg
=
AddClassToPurchase
(
server
=
self
.
server
,
classId
=
class_id
,
header
=
self
.
header
,
studentId
=
self
.
userId
)
.
class_add_to_purchase
()
with
assume
:
assert
purchase_msg
.
get
(
'code'
)
==
0
with
assume
:
assert
purchase_msg
.
get
(
'msg'
)
==
'成功'
with
assume
:
assert
purchase_msg
.
get
(
'data'
)
.
get
(
'result'
)
==
0
with
assume
:
assert
purchase_msg
.
get
(
'data'
)
.
get
(
'msg'
)
==
'OK'
@allure.story
(
'加入购课单'
)
@allure.title
(
'不符合网报年级的班级,加入购课单'
)
@allure.description
(
'不符合网报年级的班级,加入购课单'
)
def
test_not_class_and_add_purchase
(
self
):
# 设置网报年级不符合该学生
course_id
=
CreateCourse
(
server
=
self
.
server
,
classType
=
'专题'
,
courseType
=
'专题班课'
,
productType
=
'副线课程'
,
year
=
StaticGlobal
.
YEAR
,
term
=
StaticGlobal
.
TERM
,
registerGrade
=
'一年级'
)
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
class_id
=
CreateClass
(
server
=
self
.
server
,
courseId
=
course_id
,
schoolArea
=
self
.
schoolArea
)
.
create_class
()[
'classId'
]
NetWork
(
server
=
self
.
server
,
resignClassIds
=
[
class_id
])
.
network_set
()
purchase_msg
=
AddClassToPurchase
(
server
=
self
.
server
,
classId
=
class_id
,
header
=
self
.
header
,
studentId
=
self
.
userId
)
.
class_add_to_purchase
()
with
assume
:
assert
purchase_msg
.
get
(
'code'
)
==
0
with
assume
:
assert
purchase_msg
.
get
(
'msg'
)
==
'成功'
with
assume
:
assert
purchase_msg
.
get
(
'data'
)
.
get
(
'result'
)
==
0
with
assume
:
assert
purchase_msg
.
get
(
'data'
)
.
get
(
'msg'
)
==
'OK'
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_purchase_class/test_auth_remove_purchase.py
0 → 100644
View file @
09e47033
"""
@encoding: utf-8
@Author: LiuHangXin
@Time: 2021/5/6
"""
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_purchase_class/test_auth_update_puchase.py
deleted
100644 → 0
View file @
d762bafd
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_purchase_class/test_auth_update_purchase.py
0 → 100644
View file @
09e47033
"""
@encoding: utf-8
@Author: LiuHangXin
@Time: 2021/5/6
"""
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_purchase_class/test_show_puchase.py
deleted
100644 → 0
View file @
d762bafd
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_purchase_class/test_show_purchase.py
0 → 100644
View file @
09e47033
"""
@encoding: utf-8
@Author: LiuHangXin
@Time: 2021/5/6
"""
script/xin_project_patriarch_app/xin_patriarch_app/
test_xin_purchase_class/test_auth_remove_puchase
.py
→
script/xin_project_patriarch_app/xin_patriarch_app/
xin_patriach_static/xin_choose_class/xin_add_class_to_purchase/__init__
.py
View file @
09e47033
File moved
script/xin_project_patriarch_app/xin_patriarch_app/xin_patriach_static/xin_choose_class/xin_add_class_to_purchase/xin_class_add_to_purchase.py
0 → 100644
View file @
09e47033
from
script.base_api
import
app_purchaseOrder_studentId_student_post
class
AddClassToPurchase
:
def
__init__
(
self
,
server
,
classId
,
header
,
studentId
):
"""
@param server: 服务
@param classId: 班级id
@param header: 请求头
@param studentId: 学生id
"""
self
.
server
=
server
self
.
classId
=
classId
self
.
studentId
=
studentId
self
.
headers
=
header
self
.
body
=
{
"type"
:
"single"
,
"classes"
:
[
str
(
self
.
classId
)
]
}
"""
家长APP加入购课单
"""
def
class_add_to_purchase
(
self
):
results_data
=
app_purchaseOrder_studentId_student_post
(
header
=
self
.
headers
,
body
=
self
.
body
,
studentId
=
self
.
studentId
)
return
results_data
script/xin_project_patriarch_app/xin_patriarch_app/xin_patriach_static/xin_public_class/xin_change_list_index.py
View file @
09e47033
class
ChangeListIndex
:
"""
用来返回info_name所在列表的值以及下标
"""
@classmethod
def
change_list_index
(
cls
,
data
:
list
,
key_name
,
info_name
):
"""
@param data: 列表
@param key_name: 列表中的主键
@param info_name: value值
@return: 返回列表
"""
return
dict
((
data_msg
[
key_name
],
dict
(
data_msg
,
index
=
index
))
for
(
index
,
data_msg
)
in
enumerate
(
data
))[
info_name
]
script/xin_project_patriarch_app/xin_patriarch_app/xin_patriach_static/xin_public_class/xin_global_static.py
View file @
09e47033
from
common.common_config
import
common_config
class
StaticGlobal
:
YEAR
=
2021
TERM
=
'春'
...
...
script/xin_project_patriarch_app/xin_static/xin_crm/xin_student.py
View file @
09e47033
import
requests
import
urllib3
from
script.base_api
import
clue_manualInputAdd_post
,
clue_delete_delete
...
...
script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_add_class.py
View file @
09e47033
...
...
@@ -61,7 +61,7 @@ class CreateClass:
year
=
jsonpath
.
jsonpath
(
courseId
,
'$...year'
)[
0
]
subject
=
jsonpath
.
jsonpath
(
courseId
,
'$...subject'
)[
0
]
term
=
jsonpath
.
jsonpath
(
courseId
,
'$...term'
)[
0
]
registerGrade
=
jsonpath
.
jsonpath
(
courseId
,
'$...registerG
rade'
)[
0
]
grade
=
jsonpath
.
jsonpath
(
courseId
,
'$...g
rade'
)[
0
]
classType
=
jsonpath
.
jsonpath
(
courseId
,
'$...classType'
)[
0
]
self
.
courseId
=
jsonpath
.
jsonpath
(
courseId
,
'$...courseId'
)[
0
]
courseType
=
jsonpath
.
jsonpath
(
courseId
,
'$...courseType'
)[
0
]
...
...
@@ -113,7 +113,7 @@ class CreateClass:
"classType"
:
classType
,
"year"
:
year
,
"term"
:
term
,
"grade"
:
registerG
rade
,
"grade"
:
g
rade
,
"subject"
:
subject
,
"classStatus"
:
"在读"
,
"schoolAreaIds"
:
[
...
...
script/xin_project_patriarch_app/xin_static/xin_educational/xin_course_handle/xin_course.py
View file @
09e47033
import
datetime
import
requests
from
script.base_api
import
education_courses_add_post
,
education_courses_query_post
,
education_courses_delete_post
from
script.xin_project_patriarch_app.xin_static.xin_service.xin_service
import
Service_get
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
...
...
script/xin_project_patriarch_app/xin_static/xin_educational/xin_course_handle/xin_update_course.py
View file @
09e47033
import
requests
from
script.base_api
import
education_courses_modifyPrice_post
,
education_courses_queryById_get
,
education_update_course_class_post
from
script.base_api
import
education_courses_modifyPrice_post
,
education_courses_queryById_get
,
education_update_course_class_post
,
education_courses_startOrStop_put
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
...
...
@@ -181,6 +181,33 @@ class UpdateCourseSchool:
return
requests
.
post
(
url
=
self
.
server
+
self
.
update_school_url
,
json
=
self
.
update_body
,
headers
=
self
.
headers
,
verify
=
False
)
.
json
()
"""
停用或启用课程
"""
class
StopOrStartCourse
:
def
__init__
(
self
,
server
,
course_data
,
username
=
None
,
password
=
None
):
"""
@param server: 服务
@param course_data: [{"courseId":10038356,"courseStatus":2}],请求参数,1是启用,2是停用
@param username: 用户名
@param password: 密码
"""
self
.
server
=
server
self
.
course_data
=
course_data
self
.
username
=
username
self
.
password
=
password
self
.
headers
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
self
.
password
)
.
get_headers
()
def
stop_or_start_course
(
self
):
return
education_courses_startOrStop_put
(
body
=
self
.
course_data
,
header
=
self
.
headers
)
if
__name__
==
'__main__'
:
server_ip
=
'http://172.10.62.94'
return_data
=
UpdateCoursePrice
(
server
=
server_ip
,
courseId
=
10035293
,
coursePrice
=
100
)
.
update_course_price
()
...
...
script/xin_project_patriarch_app/xin_static/xin_setting/xin_school.py
View file @
09e47033
...
...
@@ -19,10 +19,20 @@ class School:
def
school_update
(
self
):
# school_url = '/service-user/departments/school'
school_data
=
departments_school_post
(
body
=
self
.
body
,
header
=
self
.
headers
,
default_assert
=
False
)
return
school_data
.
json
()
return
school_data
@classmethod
def
param
(
cls
,
sectionSetting
=
1
):
def
param
(
cls
,
sectionValue
,
sectionSetting
=
1
):
"""
@param sectionValue: 连报 "sectionValue": [
{"term": "秋", "upRegisterDeadline": "2021/01/27 23:59:59", "registerDeadline": "2021/2/28 23:59:59"},
{"term": "寒", "upRegisterDeadline": "2020/10/30 23:59:59", "registerDeadline": "2020/10/31 23:59:59"},
{"term": "春", "upRegisterDeadline": "2021/03/27 23:59:59", "registerDeadline": "2021/04/30 23:59:59"},
{"term": "暑", "upRegisterDeadline": "2021/01/27 23:59:59", "registerDeadline": "2021/01/30 23:59:59"},
]
@param sectionSetting: 是否设置连报,1为是,0为否
@return:
"""
data
=
{
"id"
:
3052
,
"name"
:
"测试成都校区"
,
...
...
@@ -42,22 +52,28 @@ class School:
"latitude"
:
30.654541
,
"seatRule"
:
{
"enable"
:
True
},
"sectionSetting"
:
1
,
"sectionValue"
:
[
{
"term"
:
"秋"
,
"upRegisterDeadline"
:
"2021/01/27 23:59:59"
,
"registerDeadline"
:
"2021/2/28 23:59:59"
},
{
"term"
:
"寒"
,
"upRegisterDeadline"
:
"2020/10/30 23:59:59"
,
"registerDeadline"
:
"2020/10/31 23:59:59"
},
{
"term"
:
"春"
,
"upRegisterDeadline"
:
"2021/03/27 23:59:59"
,
"registerDeadline"
:
"2021/04/30 23:59:59"
},
{
"term"
:
"暑"
,
"upRegisterDeadline"
:
"2021/01/27 23:59:59"
,
"registerDeadline"
:
"2021/01/30 23:59:59"
},
],
"sectionValue"
:
sectionValue
,
}
if
sectionSetting
==
0
:
data
[
'sectionSetting'
]
=
0
data
.
pop
(
'sectionValue'
)
print
(
data
)
return
data
if
__name__
==
'__main__'
:
print
(
School
(
server
=
Service_get
.
service_content
(
'94'
),
body
=
School
.
param
())
.
school_update
())
print
(
School
.
param
())
print
(
School
(
server
=
Service_get
.
service_content
(
'36'
),
body
=
School
.
param
(
sectionSetting
=
1
,
sectionValue
=
[
{
"term"
:
"秋"
,
"upRegisterDeadline"
:
"2021/01/27 23:59:59"
,
"registerDeadline"
:
"2022/2/28 23:59:59"
},
{
"term"
:
"寒"
,
"upRegisterDeadline"
:
"2020/10/30 23:59:59"
,
"registerDeadline"
:
"2020/10/31 23:59:59"
},
{
"term"
:
"春"
,
"upRegisterDeadline"
:
"2021/03/27 23:59:59"
,
"registerDeadline"
:
"2021/04/30 23:59:59"
},
{
"term"
:
"暑"
,
"upRegisterDeadline"
:
"2021/01/27 23:59:59"
,
"registerDeadline"
:
"2021/01/30 23:59:59"
},
]))
.
school_update
())
# print(School.param(sectionValue=[
# {"term": "秋", "upRegisterDeadline": "2021/01/27 23:59:59", "registerDeadline": "2021/2/28 23:59:59"},
# {"term": "寒", "upRegisterDeadline": "2020/10/30 23:59:59", "registerDeadline": "2020/10/31 23:59:59"},
# {"term": "春", "upRegisterDeadline": "2021/03/27 23:59:59", "registerDeadline": "2021/04/30 23:59:59"},
# {"term": "暑", "upRegisterDeadline": "2021/01/27 23:59:59", "registerDeadline": "2021/01/30 23:59:59"},
# ]))
"""
这是是否连报设置
"communiqueRule": {
...
...
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