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
91329bea
Commit
91329bea
authored
Apr 14, 2021
by
小刘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改allure显示标题
parent
1f7f7795
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
154 additions
and
45 deletions
+154
-45
workspace.xml
.idea/workspace.xml
+0
-0
test_auth_choose_class.py
...iarch_app/test_xin_choose_class/test_auth_choose_class.py
+42
-5
test_auth_classes.py
...atriarch_app/test_xin_students_class/test_auth_classes.py
+38
-9
test_auth_students_classes.py
...app/test_xin_students_class/test_auth_students_classes.py
+21
-5
test_auth_login.py
..._patriarch_app/test_xin_students_login/test_auth_login.py
+32
-19
test_auth_students.py
...triarch_app/test_xin_students_login/test_auth_students.py
+9
-5
xin_global_static.py
...xin_patriach_static/xin_public_class/xin_global_static.py
+1
-1
jky_user.yaml
...n_project_patriarch_app/xin_static/xin_user/jky_user.yaml
+6
-1
patriarch_user
..._project_patriarch_app/xin_static/xin_user/patriarch_user
+0
-0
xin_patriarch_login.py
..._patriarch_app/xin_static/xin_user/xin_patriarch_login.py
+5
-0
No files found.
.idea/workspace.xml
View file @
91329bea
This diff is collapsed.
Click to expand it.
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_choose_class/test_auth_choose_class.py
View file @
91329bea
import
datetime
import
datetime
import
time
import
time
import
allure
import
jsonpath
import
jsonpath
import
pytest
import
pytest
from
pytest_assume.plugin
import
assume
from
pytest_assume.plugin
import
assume
...
@@ -22,6 +23,8 @@ from script.xin_project_patriarch_app.xin_static.xin_time import Time_get
...
@@ -22,6 +23,8 @@ from script.xin_project_patriarch_app.xin_static.xin_time import Time_get
"""
"""
@allure.epic
(
'家长APP接口自动化测试'
)
@allure.feature
(
'选课中心'
)
class
TestChooseClasses
:
class
TestChooseClasses
:
global_class_id
=
None
global_class_id
=
None
...
@@ -44,6 +47,9 @@ class TestChooseClasses:
...
@@ -44,6 +47,9 @@ class TestChooseClasses:
NetWork
(
server
=
self
.
server
,
resignClassIds
=
[
class_id
])
.
network_set
()
NetWork
(
server
=
self
.
server
,
resignClassIds
=
[
class_id
])
.
network_set
()
# 断言校区
# 断言校区
@allure.story
(
'选课中心-校区'
)
@allure.title
(
'验证校区正确'
)
@allure.description
(
'验证校区为学生在读班级中心校的同级中心校'
)
def
test_choose_class_school
(
self
):
def
test_choose_class_school
(
self
):
query_data
=
QueryStudentsMessage
(
server
=
self
.
server
,
studentPno
=
self
.
studentPho
)
.
query_students_message
()
query_data
=
QueryStudentsMessage
(
server
=
self
.
server
,
studentPno
=
self
.
studentPho
)
.
query_students_message
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'code'
]
==
0
...
@@ -52,6 +58,9 @@ class TestChooseClasses:
...
@@ -52,6 +58,9 @@ class TestChooseClasses:
with
assume
:
assert
self
.
studentPho
in
query_data
[
'data'
][
0
][
'student'
][
'phones'
]
with
assume
:
assert
self
.
studentPho
in
query_data
[
'data'
][
0
][
'student'
][
'phones'
]
# 断言班级没有网报时间,不显示
# 断言班级没有网报时间,不显示
@allure.story
(
'选课列表-班级'
)
@allure.title
(
'验证没有网报时间,不显示'
)
@allure.description
(
'班级没有设置网报时间,不显示'
)
def
test_choose_not_notwork_time
(
self
):
def
test_choose_not_notwork_time
(
self
):
course_id
=
CreateCourse
(
server
=
self
.
server
,
course_id
=
CreateCourse
(
server
=
self
.
server
,
classType
=
'专题'
,
classType
=
'专题'
,
...
@@ -65,13 +74,21 @@ class TestChooseClasses:
...
@@ -65,13 +74,21 @@ class TestChooseClasses:
with
assume
:
assert
TestChooseClasses
.
global_class_id
not
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
with
assume
:
assert
TestChooseClasses
.
global_class_id
not
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
# 网报开始时间大于当前时间,不显示
# 网报开始时间大于当前时间,不显示
@allure.story
(
'选课列表-班级'
)
@allure.title
(
'验证网报开始时间大于当前时间,不显示'
)
@allure.description
(
'班级网报开始时间大于当前时间,不显示'
)
def
test_choose_before_notwork_time
(
self
):
def
test_choose_before_notwork_time
(
self
):
NetWork
(
server
=
self
.
server
,
resignClassIds
=
[
TestChooseClasses
.
global_class_id
],
classSaleBeginDate
=
Time_get
.
get_after_want_time
(
day
=
2
)
+
'00:00:00'
)
.
network_set
()
NetWork
(
server
=
self
.
server
,
resignClassIds
=
[
TestChooseClasses
.
global_class_id
],
classSaleBeginDate
=
Time_get
.
get_after_want_time
(
day
=
2
)
+
' 00:00:00'
,
classSaleEndDate
=
Time_get
.
get_after_want_time
(
day
=
10
,
second
=
True
))
.
network_set
()
choose_data
=
ChooseClasses
(
server
=
self
.
server
,
studentId
=
self
.
userId
,
schoolAreaId
=
self
.
schoolArea
)
.
choose_class
()
choose_data
=
ChooseClasses
(
server
=
self
.
server
,
studentId
=
self
.
userId
,
schoolAreaId
=
self
.
schoolArea
)
.
choose_class
()
with
assume
:
assert
choose_data
[
'code'
]
==
0
with
assume
:
assert
choose_data
[
'code'
]
==
0
with
assume
:
assert
TestChooseClasses
.
global_class_id
not
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
with
assume
:
assert
TestChooseClasses
.
global_class_id
not
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
# 网报结束时间小于当前时间,不显示
# 网报结束时间小于当前时间,不显示
@allure.story
(
'选课列表-班级'
)
@allure.title
(
'验证网报结束时间小于当前时间,不显示'
)
@allure.description
(
'班级网报结束时间小于当前时间,不显示'
)
def
test_choose_after_notwork_time
(
self
):
def
test_choose_after_notwork_time
(
self
):
begin_time
=
Time_get
.
get_before_want_time
(
day
=
10
)
+
' 00:00:00'
begin_time
=
Time_get
.
get_before_want_time
(
day
=
10
)
+
' 00:00:00'
end_time
=
Time_get
.
get_before_want_time
(
day
=
2
)
+
' 23:59:59'
end_time
=
Time_get
.
get_before_want_time
(
day
=
2
)
+
' 23:59:59'
...
@@ -81,6 +98,9 @@ class TestChooseClasses:
...
@@ -81,6 +98,9 @@ class TestChooseClasses:
with
assume
:
assert
TestChooseClasses
.
global_class_id
not
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
with
assume
:
assert
TestChooseClasses
.
global_class_id
not
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
# 当前时间在网报开始和结束之间
# 当前时间在网报开始和结束之间
@allure.story
(
'选课列表-班级'
)
@allure.title
(
'验证当前时间在网报开始和结束之间,显示'
)
@allure.description
(
'验证当前时间在网报开始和结束之间,显示'
)
def
test_choose_in_notwork_time
(
self
):
def
test_choose_in_notwork_time
(
self
):
NetWork
(
server
=
self
.
server
,
resignClassIds
=
[
TestChooseClasses
.
global_class_id
])
.
network_set
()
NetWork
(
server
=
self
.
server
,
resignClassIds
=
[
TestChooseClasses
.
global_class_id
])
.
network_set
()
choose_data
=
ChooseClasses
(
server
=
self
.
server
,
studentId
=
self
.
userId
,
schoolAreaId
=
self
.
schoolArea
)
.
choose_class
()
choose_data
=
ChooseClasses
(
server
=
self
.
server
,
studentId
=
self
.
userId
,
schoolAreaId
=
self
.
schoolArea
)
.
choose_class
()
...
@@ -88,6 +108,9 @@ class TestChooseClasses:
...
@@ -88,6 +108,9 @@ class TestChooseClasses:
with
assume
:
assert
TestChooseClasses
.
global_class_id
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
with
assume
:
assert
TestChooseClasses
.
global_class_id
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
# 只设置了网报时间,没有设置报名时间
# 只设置了网报时间,没有设置报名时间
@allure.story
(
'选课列表-班级'
)
@allure.title
(
'班级只有网报时间,没有报名时间'
)
@allure.description
(
'报名时间为空,班级显示'
)
def
test_choose_not_sign_time
(
self
):
def
test_choose_not_sign_time
(
self
):
NetWork
(
server
=
self
.
server
,
resignClassIds
=
[
TestChooseClasses
.
global_class_id
],
classSignBeginDate
=
' '
,
classSignEndDate
=
' '
)
.
network_set
()
NetWork
(
server
=
self
.
server
,
resignClassIds
=
[
TestChooseClasses
.
global_class_id
],
classSignBeginDate
=
' '
,
classSignEndDate
=
' '
)
.
network_set
()
choose_data
=
ChooseClasses
(
server
=
self
.
server
,
studentId
=
self
.
userId
,
schoolAreaId
=
self
.
schoolArea
)
.
choose_class
()
choose_data
=
ChooseClasses
(
server
=
self
.
server
,
studentId
=
self
.
userId
,
schoolAreaId
=
self
.
schoolArea
)
.
choose_class
()
...
@@ -98,6 +121,9 @@ class TestChooseClasses:
...
@@ -98,6 +121,9 @@ class TestChooseClasses:
with
assume
:
assert
assert_data
[
'id'
]
==
TestChooseClasses
.
global_class_id
with
assume
:
assert
assert_data
[
'id'
]
==
TestChooseClasses
.
global_class_id
# 改为正常的报名时间
# 改为正常的报名时间
@allure.story
(
'选课列表-班级'
)
@allure.title
(
'当期时间在报名时间之间'
)
@allure.description
(
'当期时间在报名时间之间,正常显示'
)
def
test_choose_normal_sign_time
(
self
):
def
test_choose_normal_sign_time
(
self
):
NetWork
(
server
=
self
.
server
,
resignClassIds
=
[
TestChooseClasses
.
global_class_id
])
.
network_set
()
NetWork
(
server
=
self
.
server
,
resignClassIds
=
[
TestChooseClasses
.
global_class_id
])
.
network_set
()
choose_data
=
ChooseClasses
(
server
=
self
.
server
,
studentId
=
self
.
userId
,
schoolAreaId
=
self
.
schoolArea
)
.
choose_class
()
choose_data
=
ChooseClasses
(
server
=
self
.
server
,
studentId
=
self
.
userId
,
schoolAreaId
=
self
.
schoolArea
)
.
choose_class
()
...
@@ -108,6 +134,9 @@ class TestChooseClasses:
...
@@ -108,6 +134,9 @@ class TestChooseClasses:
with
assume
:
assert
assert_data
[
'id'
]
==
TestChooseClasses
.
global_class_id
with
assume
:
assert
assert_data
[
'id'
]
==
TestChooseClasses
.
global_class_id
# 网报年级和学生在读年级不匹配,不显示
# 网报年级和学生在读年级不匹配,不显示
@allure.story
(
'选课列表-班级'
)
@allure.title
(
'网报年级和学生在读年级不匹配'
)
@allure.description
(
'网报年级和学生在读年级不匹配,不显示'
)
def
test_choose_not_grade
(
self
):
def
test_choose_not_grade
(
self
):
course_id
=
CreateCourse
(
server
=
self
.
server
,
course_id
=
CreateCourse
(
server
=
self
.
server
,
classType
=
'专题'
,
classType
=
'专题'
,
...
@@ -123,6 +152,9 @@ class TestChooseClasses:
...
@@ -123,6 +152,9 @@ class TestChooseClasses:
with
assume
:
assert
class_id
not
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
with
assume
:
assert
class_id
not
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
# 不显示除新生班外的常规班
# 不显示除新生班外的常规班
@allure.story
(
'选课列表-班级'
)
@allure.title
(
'不显示除新生班外的常规班'
)
@allure.description
(
'不显示除新生班外的常规班'
)
def
test_choose_groove_class
(
self
):
def
test_choose_groove_class
(
self
):
course_id
=
CreateCourse
(
server
=
self
.
server
,
course_id
=
CreateCourse
(
server
=
self
.
server
,
classType
=
'极趣班'
,
classType
=
'极趣班'
,
...
@@ -137,6 +169,9 @@ class TestChooseClasses:
...
@@ -137,6 +169,9 @@ class TestChooseClasses:
with
assume
:
assert
class_id
not
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
with
assume
:
assert
class_id
not
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
# 不显示精品班
# 不显示精品班
@allure.story
(
'选课列表-班级'
)
@allure.title
(
'不显示精品班'
)
@allure.description
(
'不显示精品班'
)
def
test_choose_boutique_class
(
self
):
def
test_choose_boutique_class
(
self
):
course_id
=
CreateCourse
(
server
=
self
.
server
,
course_id
=
CreateCourse
(
server
=
self
.
server
,
classType
=
'一对一定制班'
,
classType
=
'一对一定制班'
,
...
@@ -151,6 +186,9 @@ class TestChooseClasses:
...
@@ -151,6 +186,9 @@ class TestChooseClasses:
with
assume
:
assert
class_id
not
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
with
assume
:
assert
class_id
not
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
# 购买精品班,查看精品班,不显示
# 购买精品班,查看精品班,不显示
@allure.story
(
'选课列表-班级'
)
@allure.title
(
'报名精品班,查看精品班'
)
@allure.description
(
'不显示精品班'
)
def
test_choose_buy_boutique_class
(
self
):
def
test_choose_buy_boutique_class
(
self
):
course_id
=
CreateCourse
(
server
=
self
.
server
,
course_id
=
CreateCourse
(
server
=
self
.
server
,
classType
=
'一对三定制班'
,
classType
=
'一对三定制班'
,
...
@@ -178,6 +216,9 @@ class TestChooseClasses:
...
@@ -178,6 +216,9 @@ class TestChooseClasses:
with
assume
:
assert
'极趣班'
not
in
jsonpath
.
jsonpath
(
choose_data
,
'$..classType'
)
with
assume
:
assert
'极趣班'
not
in
jsonpath
.
jsonpath
(
choose_data
,
'$..classType'
)
with
assume
:
assert
class_id
not
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
with
assume
:
assert
class_id
not
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
@allure.story
(
'选课列表-班级'
)
@allure.title
(
'验证没有报常规班,可以看未来的副线和常规'
)
@allure.description
(
'验证没有报常规班,可以看未来的副线和常规'
)
def
test_choose_groove_term_class
(
self
):
def
test_choose_groove_term_class
(
self
):
create_class_data
=
[[
'副线课程'
,
'专题'
,
'专题班课'
,
'数学'
,
2020
,
'寒'
],
create_class_data
=
[[
'副线课程'
,
'专题'
,
'专题班课'
,
'数学'
,
2020
,
'寒'
],
[
'副线课程'
,
'专题'
,
'专题班课'
,
'数学'
,
StaticGlobal
.
YEAR
+
1
,
'秋'
],
[
'副线课程'
,
'专题'
,
'专题班课'
,
'数学'
,
StaticGlobal
.
YEAR
+
1
,
'秋'
],
...
@@ -200,7 +241,3 @@ class TestChooseClasses:
...
@@ -200,7 +241,3 @@ class TestChooseClasses:
with
assume
:
assert
class_id
[
1
]
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
with
assume
:
assert
class_id
[
1
]
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
with
assume
:
assert
class_id
[
2
]
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
with
assume
:
assert
class_id
[
2
]
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
with
assume
:
assert
class_id
[
3
]
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
with
assume
:
assert
class_id
[
3
]
in
jsonpath
.
jsonpath
(
choose_data
,
'$..id'
)
if
__name__
==
'__main__'
:
pytest
.
main
([
'test_auth_choose_class.py'
,
'-s'
])
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_students_class/test_auth_classes.py
View file @
91329bea
import
datetime
import
datetime
import
time
import
time
import
allure
import
jsonpath
import
jsonpath
import
pytest
from
pytest_assume.plugin
import
assume
from
pytest_assume.plugin
import
assume
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_patriarch_app.xin_patriach_static.xin_public_class.xin_global_static
import
StaticGlobal
...
@@ -19,6 +19,8 @@ from script.xin_project_patriarch_app.xin_static.xin_user.xin_patriarch_login im
...
@@ -19,6 +19,8 @@ from script.xin_project_patriarch_app.xin_static.xin_user.xin_patriarch_login im
"""
"""
@allure.epic
(
'家长APP接口自动化测试'
)
@allure.feature
(
'学生在读班级列表'
)
class
TestAuthNotBuyClasses
:
class
TestAuthNotBuyClasses
:
def
setup_class
(
self
):
def
setup_class
(
self
):
self
.
server
=
StaticGlobal
.
SERVER
self
.
server
=
StaticGlobal
.
SERVER
...
@@ -31,6 +33,9 @@ class TestAuthNotBuyClasses:
...
@@ -31,6 +33,9 @@ class TestAuthNotBuyClasses:
验证没有报班,班级列表为空
验证没有报班,班级列表为空
"""
"""
@allure.story
(
'学生没有在读班级'
)
@allure.title
(
'学生没有在读班级,列表为空'
)
@allure.description
(
'学生没有在读班级,列表为空'
)
def
test_query_new_students
(
self
):
def
test_query_new_students
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
)
.
query_class_list
()
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
)
.
query_class_list
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'code'
]
==
0
...
@@ -43,6 +48,8 @@ class TestAuthNotBuyClasses:
...
@@ -43,6 +48,8 @@ class TestAuthNotBuyClasses:
"""
"""
@allure.epic
(
'家长APP接口自动化测试'
)
@allure.feature
(
'学生在读班级列表'
)
class
TestAuthHaveClasses
:
class
TestAuthHaveClasses
:
def
setup_class
(
self
):
def
setup_class
(
self
):
self
.
server
=
StaticGlobal
.
SERVER
self
.
server
=
StaticGlobal
.
SERVER
...
@@ -62,9 +69,7 @@ class TestAuthHaveClasses:
...
@@ -62,9 +69,7 @@ class TestAuthHaveClasses:
productType
=
class_data
[
0
],
productType
=
class_data
[
0
],
classType
=
class_data
[
1
],
classType
=
class_data
[
1
],
courseType
=
class_data
[
2
],
courseType
=
class_data
[
2
],
subject
=
class_data
[
3
],
subject
=
class_data
[
3
])
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
year
=
StaticGlobal
.
YEAR
,
term
=
StaticGlobal
.
TERM
)
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
class_id
=
CreateClass
(
server
=
self
.
server
,
courseId
=
self
.
course_id
)
.
create_class
()[
'classId'
]
class_id
=
CreateClass
(
server
=
self
.
server
,
courseId
=
self
.
course_id
)
.
create_class
()[
'classId'
]
self
.
details
.
append
({
self
.
details
.
append
({
"classId"
:
class_id
,
"classId"
:
class_id
,
...
@@ -80,8 +85,11 @@ class TestAuthHaveClasses:
...
@@ -80,8 +85,11 @@ class TestAuthHaveClasses:
"payAmount"
:
700
"payAmount"
:
700
}
}
])
.
pay_order
()
])
.
pay_order
()
time
.
sleep
(
2
)
time
.
sleep
(
3
)
@allure.story
(
'学生有在读班级'
)
@allure.title
(
'查询学生所有的班级'
)
@allure.description
(
'查询学生所有的班级,验证有常规班'
)
def
test_query_all
(
self
):
def
test_query_all
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
)
.
query_class_list
()
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
)
.
query_class_list
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'code'
]
==
0
...
@@ -90,6 +98,9 @@ class TestAuthHaveClasses:
...
@@ -90,6 +98,9 @@ class TestAuthHaveClasses:
with
assume
:
assert
'常规班课'
in
jsonpath
.
jsonpath
(
query_data
,
'$...courseType'
)
with
assume
:
assert
'常规班课'
in
jsonpath
.
jsonpath
(
query_data
,
'$...courseType'
)
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...classId'
)[
0
]
==
self
.
details
[
0
][
'classId'
]
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...classId'
)[
0
]
==
self
.
details
[
0
][
'classId'
]
@allure.story
(
'学生有在读班级'
)
@allure.title
(
'数学科目筛选'
)
@allure.description
(
'查询在读班级中有数学科目,没有语文科目'
)
def
test_query_have_subject
(
self
):
def
test_query_have_subject
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
subjects
=
[
'数学'
])
.
query_class_list
()
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
subjects
=
[
'数学'
])
.
query_class_list
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'code'
]
==
0
...
@@ -97,12 +108,19 @@ class TestAuthHaveClasses:
...
@@ -97,12 +108,19 @@ class TestAuthHaveClasses:
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...subject'
)[
0
]
==
'数学'
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...subject'
)[
0
]
==
'数学'
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...subject'
)[
0
]
!=
'语文'
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...subject'
)[
0
]
!=
'语文'
@allure.story
(
'学生有在读班级'
)
@allure.title
(
'语文科目筛选'
)
@allure.description
(
'查询在读班级中有语文科目,没有数学科目'
)
def
test_query_not_subject
(
self
):
def
test_query_not_subject
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
subjects
=
[
'语文'
])
.
query_class_list
()
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
subjects
=
[
'语文'
])
.
query_class_list
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'msg'
]
==
'成功'
with
assume
:
assert
query_data
[
'msg'
]
==
'成功'
with
assume
:
assert
query_data
[
'data'
][
'studentClassInfoDtoList'
]
!=
[]
with
assume
:
assert
query_data
[
'data'
][
'studentClassInfoDtoList'
]
!=
[]
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...subject'
)[
0
]
==
'语文'
@allure.story
(
'学生有在读班级'
)
@allure.title
(
'常规班课筛选'
)
@allure.description
(
'查询在读班级中班型只有常规班课'
)
def
test_query_classType
(
self
):
def
test_query_classType
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
courseTypes
=
[
'常规班课'
])
.
query_class_list
()
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
courseTypes
=
[
'常规班课'
])
.
query_class_list
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'code'
]
==
0
...
@@ -110,12 +128,18 @@ class TestAuthHaveClasses:
...
@@ -110,12 +128,18 @@ class TestAuthHaveClasses:
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...courseType'
)[
0
]
==
'常规班课'
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...courseType'
)[
0
]
==
'常规班课'
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...courseType'
)[
0
]
!=
'精品定制课'
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...courseType'
)[
0
]
!=
'精品定制课'
@allure.story
(
'学生有在读班级'
)
@allure.title
(
'集训班课筛选'
)
@allure.description
(
'查询在读班级中班型只有集训班'
)
def
test_query_not_classType
(
self
):
def
test_query_not_classType
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
courseTypes
=
[
'集训班课'
])
.
query_class_list
()
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
courseTypes
=
[
'集训班课'
])
.
query_class_list
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'msg'
]
==
'成功'
with
assume
:
assert
query_data
[
'msg'
]
==
'成功'
with
assume
:
assert
query_data
[
'data'
][
'studentClassInfoDtoList'
]
!=
[]
with
assume
:
assert
query_data
[
'data'
][
'studentClassInfoDtoList'
]
!=
[]
@allure.story
(
'学生有在读班级'
)
@allure.title
(
'春期段筛选'
)
@allure.description
(
'查询在读班级中期段为春的班级'
)
def
test_query_classTerm
(
self
):
def
test_query_classTerm
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
classTerms
=
[
'春'
])
.
query_class_list
()
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
classTerms
=
[
'春'
])
.
query_class_list
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'code'
]
==
0
...
@@ -123,12 +147,18 @@ class TestAuthHaveClasses:
...
@@ -123,12 +147,18 @@ class TestAuthHaveClasses:
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...classTerm'
)[
0
]
==
'春'
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...classTerm'
)[
0
]
==
'春'
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...classTerm'
)[
0
]
!=
'秋'
with
assume
:
assert
jsonpath
.
jsonpath
(
query_data
,
'$...classTerm'
)[
0
]
!=
'秋'
@allure.story
(
'学生有在读班级'
)
@allure.title
(
'寒期段筛选'
)
@allure.description
(
'查询在读班级中期段没有寒期段的班级'
)
def
test_query_not_classTerm
(
self
):
def
test_query_not_classTerm
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
classTerms
=
[
'寒'
])
.
query_class_list
()
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
classTerms
=
[
'寒'
])
.
query_class_list
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'msg'
]
==
'成功'
with
assume
:
assert
query_data
[
'msg'
]
==
'成功'
with
assume
:
assert
query_data
[
'data'
][
'studentClassInfoDtoList'
]
==
[]
with
assume
:
assert
query_data
[
'data'
][
'studentClassInfoDtoList'
]
==
[]
@allure.story
(
'学生有在读班级'
)
@allure.title
(
'科目、期段、班型筛选'
)
@allure.description
(
'查询在读班级中符合筛选条件的班级'
)
def
test_query_all_option
(
self
):
def
test_query_all_option
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
subjects
=
[
'数学'
],
classTerms
=
[
'春'
],
courseTypes
=
[
'常规班课'
])
.
query_class_list
()
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
subjects
=
[
'数学'
],
classTerms
=
[
'春'
],
courseTypes
=
[
'常规班课'
])
.
query_class_list
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'code'
]
==
0
...
@@ -140,12 +170,11 @@ class TestAuthHaveClasses:
...
@@ -140,12 +170,11 @@ class TestAuthHaveClasses:
with
assume
:
assert
'常规班课'
in
jsonpath
.
jsonpath
(
query_data
,
'$...courseType'
)
with
assume
:
assert
'常规班课'
in
jsonpath
.
jsonpath
(
query_data
,
'$...courseType'
)
with
assume
:
assert
'副线班课'
not
in
jsonpath
.
jsonpath
(
query_data
,
'$...courseType'
)
with
assume
:
assert
'副线班课'
not
in
jsonpath
.
jsonpath
(
query_data
,
'$...courseType'
)
@allure.story
(
'学生有在读班级'
)
@allure.title
(
'班级年级验证'
)
@allure.description
(
'查询在读班级中年级正确'
)
def
test_query_graduate
(
self
):
def
test_query_graduate
(
self
):
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
classStatus
=
1
)
.
query_class_list
()
query_data
=
QueryClass
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
studentId
=
self
.
userId
,
classStatus
=
1
)
.
query_class_list
()
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'code'
]
==
0
with
assume
:
assert
query_data
[
'msg'
]
==
'成功'
with
assume
:
assert
query_data
[
'msg'
]
==
'成功'
with
assume
:
assert
query_data
[
'data'
][
'studentClassInfoDtoList'
]
==
[]
with
assume
:
assert
query_data
[
'data'
][
'studentClassInfoDtoList'
]
==
[]
if
__name__
==
'__main__'
:
pytest
.
main
([
'test_auth_classes.py -s'
])
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_students_class/test_auth_students_classes.py
View file @
91329bea
import
datetime
import
datetime
import
time
import
time
import
pytest
import
allure
from
pytest_assume.plugin
import
assume
from
pytest_assume.plugin
import
assume
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_patriarch_app.xin_patriach_static.xin_public_class.xin_global_static
import
StaticGlobal
...
@@ -18,6 +18,8 @@ from script.xin_project_patriarch_app.xin_static.xin_educational.xin_course_hand
...
@@ -18,6 +18,8 @@ from script.xin_project_patriarch_app.xin_static.xin_educational.xin_course_hand
"""
"""
@allure.epic
(
'家长APP接口自动化测试'
)
@allure.feature
(
'学生在读班级详情'
)
class
TestAuthStudentsClassMessage
:
class
TestAuthStudentsClassMessage
:
def
setup_class
(
self
):
def
setup_class
(
self
):
self
.
server
=
StaticGlobal
.
SERVER
self
.
server
=
StaticGlobal
.
SERVER
...
@@ -46,6 +48,9 @@ class TestAuthStudentsClassMessage:
...
@@ -46,6 +48,9 @@ class TestAuthStudentsClassMessage:
time
.
sleep
(
2
)
time
.
sleep
(
2
)
# 断言班级名称
# 断言班级名称
@allure.story
(
'在读班级详情'
)
@allure.title
(
'验证班级名称正确'
)
@allure.description
(
'验证班级名称显示正确'
)
def
test_query_students_class
(
self
):
def
test_query_students_class
(
self
):
class_data
=
QueryStudentsClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
,
studentId
=
self
.
userId
,
username
=
self
.
studentPho
)
.
query_student_class
()
class_data
=
QueryStudentsClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
,
studentId
=
self
.
userId
,
username
=
self
.
studentPho
)
.
query_student_class
()
with
assume
:
assert
class_data
[
'code'
]
==
0
with
assume
:
assert
class_data
[
'code'
]
==
0
...
@@ -53,6 +58,9 @@ class TestAuthStudentsClassMessage:
...
@@ -53,6 +58,9 @@ class TestAuthStudentsClassMessage:
with
assume
:
assert
class_data
[
'data'
][
'className'
]
==
f
'小黄断言班级名称极趣班{StaticGlobal.YEAR}{StaticGlobal.TERM}数学'
with
assume
:
assert
class_data
[
'data'
][
'className'
]
==
f
'小黄断言班级名称极趣班{StaticGlobal.YEAR}{StaticGlobal.TERM}数学'
# 断言修改后班级名称
# 断言修改后班级名称
@allure.story
(
'在读班级详情'
)
@allure.title
(
'验证修改班级名称后显示正确'
)
@allure.description
(
'验证修改班级名称后显示正确'
)
def
test_query_students_update_className
(
self
):
def
test_query_students_update_className
(
self
):
UpdateClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
)
.
update_class_className
(
value
=
'修改后班级名称'
)
UpdateClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
)
.
update_class_className
(
value
=
'修改后班级名称'
)
class_data
=
QueryStudentsClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
,
studentId
=
self
.
userId
,
username
=
self
.
studentPho
)
.
query_student_class
()
class_data
=
QueryStudentsClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
,
studentId
=
self
.
userId
,
username
=
self
.
studentPho
)
.
query_student_class
()
...
@@ -61,6 +69,9 @@ class TestAuthStudentsClassMessage:
...
@@ -61,6 +69,9 @@ class TestAuthStudentsClassMessage:
with
assume
:
assert
class_data
[
'data'
][
'className'
]
==
'修改后班级名称'
with
assume
:
assert
class_data
[
'data'
][
'className'
]
==
'修改后班级名称'
# 断言校区
# 断言校区
@allure.story
(
'在读班级详情'
)
@allure.title
(
'验证班级校区正确'
)
@allure.description
(
'验证班级校区正确'
)
def
test_query_students_school
(
self
):
def
test_query_students_school
(
self
):
class_data
=
QueryStudentsClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
,
studentId
=
self
.
userId
,
username
=
self
.
studentPho
)
.
query_student_class
()
class_data
=
QueryStudentsClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
,
studentId
=
self
.
userId
,
username
=
self
.
studentPho
)
.
query_student_class
()
with
assume
:
assert
class_data
[
'code'
]
==
0
with
assume
:
assert
class_data
[
'code'
]
==
0
...
@@ -68,6 +79,9 @@ class TestAuthStudentsClassMessage:
...
@@ -68,6 +79,9 @@ class TestAuthStudentsClassMessage:
with
assume
:
assert
class_data
[
'data'
][
'schoolName'
]
==
'测试成都校区'
with
assume
:
assert
class_data
[
'data'
][
'schoolName'
]
==
'测试成都校区'
# 断言没有老师
# 断言没有老师
@allure.story
(
'在读班级详情'
)
@allure.title
(
'验证班级没有老师'
)
@allure.description
(
'验证班级没有老师显示正确'
)
def
test_query_students_teacher
(
self
):
def
test_query_students_teacher
(
self
):
class_data
=
QueryStudentsClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
,
studentId
=
self
.
userId
,
username
=
self
.
studentPho
)
.
query_student_class
()
class_data
=
QueryStudentsClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
,
studentId
=
self
.
userId
,
username
=
self
.
studentPho
)
.
query_student_class
()
with
assume
:
assert
class_data
[
'code'
]
==
0
with
assume
:
assert
class_data
[
'code'
]
==
0
...
@@ -76,6 +90,9 @@ class TestAuthStudentsClassMessage:
...
@@ -76,6 +90,9 @@ class TestAuthStudentsClassMessage:
with
assume
:
assert
class_data
[
'data'
][
'teacherName'
]
is
None
with
assume
:
assert
class_data
[
'data'
][
'teacherName'
]
is
None
# 断言修改老师后的名字
# 断言修改老师后的名字
@allure.story
(
'在读班级详情'
)
@allure.title
(
'验证修改班级任课老师正确'
)
@allure.title
(
'验证修改班级后老师显示正确'
)
def
test_query_students_update_teacher
(
self
):
def
test_query_students_update_teacher
(
self
):
UpdateClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
)
.
update_class_teacher
(
value
=
{
UpdateClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
)
.
update_class_teacher
(
value
=
{
"id"
:
9384
,
"id"
:
9384
,
...
@@ -89,12 +106,11 @@ class TestAuthStudentsClassMessage:
...
@@ -89,12 +106,11 @@ class TestAuthStudentsClassMessage:
with
assume
:
assert
class_data
[
'data'
][
'teacherName'
]
==
'刘黄鑫'
with
assume
:
assert
class_data
[
'data'
][
'teacherName'
]
==
'刘黄鑫'
# 断言学科
# 断言学科
@allure.story
(
'在读班级详情'
)
@allure.title
(
'验证班级科目正确'
)
@allure.title
(
'验证班级的科目显示正确'
)
def
test_query_students_subject
(
self
):
def
test_query_students_subject
(
self
):
class_data
=
QueryStudentsClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
,
studentId
=
self
.
userId
,
username
=
self
.
studentPho
)
.
query_student_class
()
class_data
=
QueryStudentsClass
(
server
=
self
.
server
,
classId
=
self
.
class_id
,
studentId
=
self
.
userId
,
username
=
self
.
studentPho
)
.
query_student_class
()
with
assume
:
assert
class_data
[
'code'
]
==
0
with
assume
:
assert
class_data
[
'code'
]
==
0
with
assume
:
assert
class_data
[
'msg'
]
==
'成功'
with
assume
:
assert
class_data
[
'msg'
]
==
'成功'
with
assume
:
assert
class_data
[
'data'
][
'subject'
]
==
'数学'
with
assume
:
assert
class_data
[
'data'
][
'subject'
]
==
'数学'
if
__name__
==
'__main__'
:
pytest
.
main
([
'test_auth_students_classes.py -s'
])
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_students_login/test_auth_login.py
View file @
91329bea
...
@@ -8,6 +8,8 @@ from script.xin_project_patriarch_app.xin_static.xin_service_user.xin_employees
...
@@ -8,6 +8,8 @@ from script.xin_project_patriarch_app.xin_static.xin_service_user.xin_employees
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_patriarch_login
import
AuthHeaders
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_patriarch_login
import
AuthHeaders
@allure.epic
(
'家长APP接口自动化测试'
)
@allure.feature
(
'登录模块'
)
@pytest.mark.run
(
order
=
1
)
@pytest.mark.run
(
order
=
1
)
class
TestAuthLogin
:
class
TestAuthLogin
:
def
setup_class
(
self
):
def
setup_class
(
self
):
...
@@ -16,36 +18,47 @@ class TestAuthLogin:
...
@@ -16,36 +18,47 @@ class TestAuthLogin:
self
.
studentPho
=
'13364004418'
self
.
studentPho
=
'13364004418'
CreateStudent
(
server
=
self
.
server
,
contactInfo
=
self
.
studentPho
)
.
create_student
()
CreateStudent
(
server
=
self
.
server
,
contactInfo
=
self
.
studentPho
)
.
create_student
()
@pytest.mark.parametrize
([
'username'
,
'password'
],
[[
'13364004418'
,
'geek1234'
]])
@allure.story
(
'登录验证'
)
def
test_login01
(
self
,
username
,
password
):
@allure.title
(
'用户名密码正确'
)
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_auth_token
()
@allure.description
(
'用户名密码正确,登录成功'
)
@allure.step
(
'输入用户名:13364004418,密码:geek1234'
)
def
test_login01
(
self
):
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
'13364004418'
,
password
=
'geek1234'
)
.
get_auth_token
()
with
assume
:
assert
auth_data
[
'code'
]
==
0
with
assume
:
assert
auth_data
[
'code'
]
==
0
with
assume
:
assert
auth_data
[
'msg'
]
==
'成功'
with
assume
:
assert
auth_data
[
'msg'
]
==
'成功'
@pytest.mark.parametrize
([
'username'
,
'password'
],
[[
'13364004418'
,
'123'
]])
@allure.story
(
'登录验证'
)
def
test_login02
(
self
,
username
,
password
):
@allure.title
(
'用户名正确,密码不正确'
)
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_auth_token
()
@allure.description
(
'用户名正确,密码不正确,登录失败'
)
@allure.step
(
'输入用户名:13364004418,密码:123'
)
def
test_login02
(
self
):
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
'13364004418'
,
password
=
'123'
)
.
get_auth_token
()
with
assume
:
assert
auth_data
[
'code'
]
!=
0
with
assume
:
assert
auth_data
[
'code'
]
!=
0
with
assume
:
assert
auth_data
[
'msg'
]
==
'用户名或密码错误!'
with
assume
:
assert
auth_data
[
'msg'
]
==
'用户名或密码错误!'
@pytest.mark.parametrize
([
'username'
,
'password'
],
[[
'11111111111'
,
'geek1234'
]])
@allure.story
(
'登录验证'
)
def
test_login03
(
self
,
username
,
password
):
@allure.title
(
'用户名错误,密码正确'
)
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_auth_token
()
@allure.description
(
'用户名错误,密码正确,登录失败'
)
@allure.step
(
'输入用户名:11111111111,密码:geek1234'
)
def
test_login03
(
self
):
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
'11111111111'
,
password
=
'geek1234'
)
.
get_auth_token
()
with
assume
:
assert
auth_data
[
'code'
]
!=
0
with
assume
:
assert
auth_data
[
'code'
]
!=
0
with
assume
:
assert
'该手机号未注册'
in
auth_data
[
'msg'
]
with
assume
:
assert
'该手机号未注册'
in
auth_data
[
'msg'
]
@pytest.mark.parametrize
([
'username'
,
'password'
],
[[
' '
,
' '
]])
@allure.story
(
'登录验证'
)
def
test_login04
(
self
,
username
,
password
):
@allure.title
(
'用户名密码为空'
)
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_auth_token
()
@allure.description
(
'用户名密码为空,登录失败'
)
@allure.step
(
'接口不传用户名和密码'
)
def
test_login04
(
self
):
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
' '
,
password
=
' '
)
.
get_auth_token
()
with
assume
:
assert
auth_data
[
'code'
]
!=
0
with
assume
:
assert
auth_data
[
'code'
]
!=
0
with
assume
:
assert
'该手机号未注册'
in
auth_data
[
'msg'
]
with
assume
:
assert
'该手机号未注册'
in
auth_data
[
'msg'
]
@pytest.mark.parametrize
([
'username'
,
'password'
],
[[
'这是中文'
,
'geek1234'
]])
@allure.story
(
'登录验证'
)
def
test_login05
(
self
,
username
,
password
):
@allure.title
(
'用户名为中文,密码正确'
)
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
username
,
password
=
password
)
.
get_auth_token
()
@allure.description
(
'用户名为中文,密码正确,登录失败'
)
@allure.step
(
'用户名为中文,密码正确'
)
def
test_login05
(
self
):
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
'这是中文'
,
password
=
'geek1234'
)
.
get_auth_token
()
with
assume
:
assert
auth_data
[
'code'
]
!=
0
with
assume
:
assert
auth_data
[
'code'
]
!=
0
with
assume
:
assert
'该手机号未注册'
in
auth_data
[
'msg'
]
with
assume
:
assert
'该手机号未注册'
in
auth_data
[
'msg'
]
if
__name__
==
'__main__'
:
pytest
.
main
([
'xin_patriarch_login.py'
])
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_students_login/test_auth_students.py
View file @
91329bea
import
allure
import
jsonpath
import
jsonpath
import
pytest
import
requests
from
pytest_assume.plugin
import
assume
from
pytest_assume.plugin
import
assume
from
script.base_api
import
app_students_phoneNumber_mobilePhoneNumberBounding_get
,
app_pushRelationship_post
from
script.base_api
import
app_students_phoneNumber_mobilePhoneNumberBounding_get
,
app_pushRelationship_post
...
@@ -8,17 +7,25 @@ from script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_
...
@@ -8,17 +7,25 @@ from script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_patriarch_login
import
AuthHeaders
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_patriarch_login
import
AuthHeaders
@allure.epic
(
'家长APP接口自动化测试'
)
@allure.feature
(
'登录模块'
)
class
TestAuthStudents
:
class
TestAuthStudents
:
def
setup_class
(
self
):
def
setup_class
(
self
):
self
.
server
=
StaticGlobal
.
SERVER
self
.
server
=
StaticGlobal
.
SERVER
self
.
header
=
AuthHeaders
(
server
=
self
.
server
,
username
=
'13364004418'
,
password
=
'geek1234'
)
.
get_auth_headers
()
self
.
header
=
AuthHeaders
(
server
=
self
.
server
,
username
=
'13364004418'
,
password
=
'geek1234'
)
.
get_auth_headers
()
@allure.story
(
'登录成功验证'
)
@allure.title
(
'验证查询学生信息正确'
)
@allure.description
(
'查询学生包含这个学生'
)
def
test_students
(
self
):
def
test_students
(
self
):
students_data
=
app_students_phoneNumber_mobilePhoneNumberBounding_get
(
phoneNumber
=
'13364004418'
,
header
=
self
.
header
,
default_assert
=
False
)
students_data
=
app_students_phoneNumber_mobilePhoneNumberBounding_get
(
phoneNumber
=
'13364004418'
,
header
=
self
.
header
,
default_assert
=
False
)
with
assume
:
assert
students_data
[
'code'
]
==
0
with
assume
:
assert
students_data
[
'code'
]
==
0
with
assume
:
assert
'小黄测试学生三年级'
in
jsonpath
.
jsonpath
(
students_data
,
'$..name'
)
with
assume
:
assert
'小黄测试学生三年级'
in
jsonpath
.
jsonpath
(
students_data
,
'$..name'
)
with
assume
:
assert
students_data
[
'data'
][
0
][
'student'
][
'phones'
][
0
]
==
'13364004418'
with
assume
:
assert
students_data
[
'data'
][
0
][
'student'
][
'phones'
][
0
]
==
'13364004418'
@allure.story
(
'登录成功验证'
)
@allure.title
(
'查询学生设备绑定关系'
)
@allure.description
(
'查询学生设备绑定关系正确'
)
def
test_push_relation
(
self
):
def
test_push_relation
(
self
):
push_data
=
{
push_data
=
{
"deviceToken"
:
"ApVZSpXWRryWKlLIbKILYE2C_KFiVLBblNotxrxF8GiT"
,
"deviceToken"
:
"ApVZSpXWRryWKlLIbKILYE2C_KFiVLBblNotxrxF8GiT"
,
...
@@ -28,6 +35,3 @@ class TestAuthStudents:
...
@@ -28,6 +35,3 @@ class TestAuthStudents:
push_data
=
app_pushRelationship_post
(
body
=
push_data
,
header
=
self
.
header
,
default_assert
=
False
)
push_data
=
app_pushRelationship_post
(
body
=
push_data
,
header
=
self
.
header
,
default_assert
=
False
)
with
assume
:
assert
push_data
[
'code'
]
==
0
with
assume
:
assert
push_data
[
'code'
]
==
0
if
__name__
==
'__main__'
:
pytest
.
main
([
'test_auth_students.py'
])
script/xin_project_patriarch_app/xin_patriarch_app/xin_patriach_static/xin_public_class/xin_global_static.py
View file @
91329bea
...
@@ -2,4 +2,4 @@ class StaticGlobal:
...
@@ -2,4 +2,4 @@ class StaticGlobal:
YEAR
=
2021
YEAR
=
2021
TERM
=
'春'
TERM
=
'春'
SCHOOL
=
3052
SCHOOL
=
3052
SERVER
=
'http://1
72.10.62.94
'
SERVER
=
'http://1
92.168.32.31
'
script/xin_project_patriarch_app/xin_static/xin_user/jky_user.yaml
View file @
91329bea
-
headers
:
-
headers
:
Authorization
:
Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiIyMTc1IiwidGVybWluYWwiOiJwYyIsInV1aWQiOiJ
iOTcwNzMzN2VlZjU0NzZlYTVhNTg5ODU0YTk5ZDQxMiIsInRpbWVzdGFtcCI6MTYxODM2OTc5Nzg5N30.d9Wkb6ovkbbOvOO8R71tgdMXWCy1sDwzFHaxAQSnaQk
Authorization
:
Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiIyMTc1IiwidGVybWluYWwiOiJwYyIsInV1aWQiOiJ
hMWFjZjZjZGEyYzc0NThlOTQwMTEyM2JkN2JhMWU3NyIsInRpbWVzdGFtcCI6MTYxODM4NTc2Mzk0M30.Bgt-BDVWP7YhrANafIBhqYRd956M0nBwpS7rJpC3_KU
Content-Type
:
application/json;charset=UTF-8
Content-Type
:
application/json;charset=UTF-8
server
:
http://172.10.62.94
server
:
http://172.10.62.94
user
:
13555555555
user
:
13555555555
-
headers
:
Authorization
:
Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiIyMTc1IiwidGVybWluYWwiOiJwYyIsInV1aWQiOiI0NGIxZTk5ZTJhOTk0ZTVhYmY2MzdiZTFmZGVkN2NiZCIsInRpbWVzdGFtcCI6MTYxODM4NjMyNTk4MX0.vFTRtWmeXXXW9238IaAzIQHuZz6bYTpCLbN1pHcYky0
Content-Type
:
application/json;charset=UTF-8
server
:
http://192.168.32.31
user
:
13555555555
script/xin_project_patriarch_app/xin_static/xin_user/patriarch_user
View file @
91329bea
This diff is collapsed.
Click to expand it.
script/xin_project_patriarch_app/xin_static/xin_user/xin_patriarch_login.py
View file @
91329bea
import
json
import
allure
import
requests
import
requests
from
requests.packages.urllib3.exceptions
import
InsecureRequestWarning
from
requests.packages.urllib3.exceptions
import
InsecureRequestWarning
...
@@ -23,8 +26,10 @@ class AuthHeaders:
...
@@ -23,8 +26,10 @@ class AuthHeaders:
获取家长端APP的登录信息
获取家长端APP的登录信息
"""
"""
@allure.step
(
'登录家长端APP'
)
def
get_auth_token
(
self
):
def
get_auth_token
(
self
):
auth_data
=
requests
.
post
(
url
=
self
.
server
+
self
.
url
,
json
=
self
.
body
,
verify
=
False
)
auth_data
=
requests
.
post
(
url
=
self
.
server
+
self
.
url
,
json
=
self
.
body
,
verify
=
False
)
allure
.
attach
(
body
=
json
.
dumps
(
auth_data
.
json
(),
ensure_ascii
=
False
),
name
=
'响应信息'
,
attachment_type
=
allure
.
attachment_type
.
JSON
)
if
auth_data
.
json
()[
'code'
]
!=
0
:
if
auth_data
.
json
()[
'code'
]
!=
0
:
return
auth_data
.
json
()
return
auth_data
.
json
()
else
:
else
:
...
...
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