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
10cd4ef3
Commit
10cd4ef3
authored
May 26, 2021
by
小刘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录修改调试
parent
f1b0a368
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
464 additions
and
208 deletions
+464
-208
common_config.py
common/common_config.py
+8
-4
connect_db.py
common/connect_db.py
+30
-4
conftest.py
script/conftest.py
+7
-2
db_config.py
script/db_config.py
+39
-2
test_auth_choose_class.py
...iarch_app/test_xin_choose_class/test_auth_choose_class.py
+0
-0
test_auth_choose_class_details.py
...p/test_xin_choose_class/test_auth_choose_class_details.py
+31
-12
test_auth_update_choose_class.py
...pp/test_xin_choose_class/test_auth_update_choose_class.py
+3
-2
test_auth_add_purchase.py
...rch_app/test_xin_purchase_class/test_auth_add_purchase.py
+27
-5
test_auth_classes.py
...atriarch_app/test_xin_students_class/test_auth_classes.py
+0
-0
test_auth_completion_class.py
...app/test_xin_students_class/test_auth_completion_class.py
+7
-5
test_auth_students_classes.py
...app/test_xin_students_class/test_auth_students_classes.py
+3
-3
test_auth_login.py
..._patriarch_app/test_xin_students_login/test_auth_login.py
+97
-28
test_auth_students.py
...triarch_app/test_xin_students_login/test_auth_students.py
+42
-8
xin_choose_classes.py
...in_patriach_static/xin_choose_class/xin_choose_classes.py
+0
-5
xin_global_static.py
...xin_patriach_static/xin_public_class/xin_global_static.py
+1
-3
xin_query_students_class.py
...triach_static/xin_query_class/xin_query_students_class.py
+0
-5
xin_query_students_message.py
...static/xin_students_message/xin_query_students_message.py
+0
-4
xin_place_order.py
...iarch_app/xin_static/xin_crm/xin_apply/xin_place_order.py
+71
-28
xin_student.py
...n_project_patriarch_app/xin_static/xin_crm/xin_student.py
+0
-4
__init__.py
...patriarch_app/xin_static/xin_crm/xin_students/__init__.py
+5
-0
xin_create_studens.py
...app/xin_static/xin_crm/xin_students/xin_create_studens.py
+91
-0
xin_add_class.py
..._static/xin_educational/xin_class_handle/xin_add_class.py
+0
-7
xin_delete_class.py
...atic/xin_educational/xin_class_handle/xin_delete_class.py
+0
-5
xin_update_class.py
...atic/xin_educational/xin_class_handle/xin_update_class.py
+0
-5
xin_course.py
...in_static/xin_educational/xin_course_handle/xin_course.py
+0
-4
xin_update_course.py
...ic/xin_educational/xin_course_handle/xin_update_course.py
+0
-6
xin_employees.py
...atriarch_app/xin_static/xin_service_user/xin_employees.py
+0
-5
xin_discounts_coupon.py
..._static/xin_setting/xin_discounts/xin_discounts_coupon.py
+0
-4
xin_discounts_event.py
...n_static/xin_setting/xin_discounts/xin_discounts_event.py
+0
-8
xin_school.py
...roject_patriarch_app/xin_static/xin_setting/xin_school.py
+0
-29
xin_jky_pc_login.py
...ect_patriarch_app/xin_static/xin_user/xin_jky_pc_login.py
+0
-4
xin_patriarch_login.py
..._patriarch_app/xin_static/xin_user/xin_patriarch_login.py
+2
-7
No files found.
common/common_config.py
View file @
10cd4ef3
common_config
=
{
common_config
=
{
"host"
:
"http://192.168.32.3
1
"
,
"host"
:
"http://192.168.32.3
6
"
,
"db_config"
:
{
"db_config"
:
{
'database'
:
'edu-admin'
,
'database'
:
'edu-admin'
,
"user"
:
'read_user'
,
"user"
:
'read_user'
,
...
@@ -11,7 +10,12 @@ common_config = {
...
@@ -11,7 +10,12 @@ common_config = {
"mongo_db_config"
:
{
"mongo_db_config"
:
{
"host"
:
'yf2.jksxb.cn'
,
"host"
:
'yf2.jksxb.cn'
,
"port"
:
27017
"port"
:
27017
},
"mysql_config"
:
{
'database'
:
''
,
'user'
:
'root'
,
'password'
:
'mysqlLan2vWfdstv8'
,
'host'
:
'yf1.jksxb.cn'
,
'port'
:
3306
}
}
}
}
common/connect_db.py
View file @
10cd4ef3
# coding=utf-8
# coding=utf-8
import
psycopg2
import
psycopg2
import
pymongo
import
pymongo
import
pymysql
from
common.common_config
import
common_config
from
common.common_config
import
common_config
class
OperationDb
:
class
OperationDb
:
# 获取pg数据库配置
database_config
=
common_config
.
get
(
"db_config"
)
database_config
=
common_config
.
get
(
"db_config"
)
# 获取mysql数据库配置
mysql_database_config
=
common_config
.
get
(
'mysql_config'
)
@classmethod
@classmethod
def
query_sql
(
cls
,
sql_str
):
def
query_sql
(
cls
,
sql_str
):
# 创建连接对象
# 创建连接对象
...
@@ -18,9 +22,33 @@ class OperationDb:
...
@@ -18,9 +22,33 @@ class OperationDb:
print
(
'查询结束'
)
print
(
'查询结束'
)
return
results
return
results
@classmethod
def
execute_mysql
(
cls
,
sql_str
,
Type
=
True
):
"""
@param sql_str: sql语句
@param Type: True为查询,False为其他
@return: 查询返回tuple,其他返回bool
"""
try
:
db
=
pymysql
.
connect
(
**
cls
.
mysql_database_config
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql_str
)
db
.
commit
()
if
Type
:
results
=
cursor
.
fetchall
()
else
:
cursor
.
close
()
return
True
return
results
except
Exception
as
e
:
db
.
rollback
()
print
(
e
)
return
False
finally
:
db
.
close
()
class
OperationMongoDb
:
class
OperationMongoDb
:
database_config
=
common_config
.
get
(
"mongo_db_config"
)
database_config
=
common_config
.
get
(
"mongo_db_config"
)
@classmethod
@classmethod
...
@@ -57,5 +85,3 @@ if __name__ == "__main__":
...
@@ -57,5 +85,3 @@ if __name__ == "__main__":
condition
=
{
"createTime"
:
"2021-04-09"
}
condition
=
{
"createTime"
:
"2021-04-09"
}
fields
=
{
'_id'
:
0
,
"schoolAreaId"
:
1
,
"subject"
:
1
,
'studentId'
:
1
}
fields
=
{
'_id'
:
0
,
"schoolAreaId"
:
1
,
"subject"
:
1
,
'studentId'
:
1
}
omd
.
query_data
(
table_name
,
condition
=
condition
,
fields
=
fields
)
omd
.
query_data
(
table_name
,
condition
=
condition
,
fields
=
fields
)
script/conftest.py
View file @
10cd4ef3
...
@@ -3,16 +3,17 @@ import pytest
...
@@ -3,16 +3,17 @@ import pytest
import
jsonpath
import
jsonpath
from
script
import
default_header
from
script
import
default_header
from
common.common_config
import
common_config
from
common.common_config
import
common_config
from
script.db_config
import
db_configs
from
script.db_config
import
db_configs
,
mysql_configs
from
script.base_api.service_user.auth
import
auth_employee_post
from
script.base_api.service_user.auth
import
auth_employee_post
from
script.defalut_account
import
accounts
from
script.defalut_account
import
accounts
from
script.base_api.service_user.departments
import
departments_schools_get
from
script.base_api.service_user.departments
import
departments_schools_get
from
script.base_api.service_user.wxMini
import
wxMini_auth_post
from
script.base_api.service_user.wxMini
import
wxMini_auth_post
from
script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_public_class.xin_global_static
import
StaticGlobal
def
pytest_addoption
(
parser
):
def
pytest_addoption
(
parser
):
# 注册一个命令行选项host
# 注册一个命令行选项host
parser
.
addoption
(
"--host"
,
default
=
"http://192.168.32.3
1
"
,
dest
=
"env"
,
help
=
"set test run env"
)
parser
.
addoption
(
"--host"
,
default
=
"http://192.168.32.3
6
"
,
dest
=
"env"
,
help
=
"set test run env"
)
# 注册一个命令行选项db
# 注册一个命令行选项db
parser
.
addoption
(
"--db"
,
default
=
"yf1"
,
dest
=
"db"
,
help
=
"set test database"
)
parser
.
addoption
(
"--db"
,
default
=
"yf1"
,
dest
=
"db"
,
help
=
"set test database"
)
# 注册一个命令行选项account
# 注册一个命令行选项account
...
@@ -27,6 +28,10 @@ def get_host(pytestconfig):
...
@@ -27,6 +28,10 @@ def get_host(pytestconfig):
allure
.
attach
(
body
=
common_config
[
"host"
],
name
=
'测试环境'
,
attachment_type
=
allure
.
attachment_type
.
TEXT
)
allure
.
attach
(
body
=
common_config
[
"host"
],
name
=
'测试环境'
,
attachment_type
=
allure
.
attachment_type
.
TEXT
)
# 初始化测试数据库配置
# 初始化测试数据库配置
common_config
[
"db_config"
]
=
db_configs
.
get
(
pytestconfig
.
getoption
(
'--db'
))
common_config
[
"db_config"
]
=
db_configs
.
get
(
pytestconfig
.
getoption
(
'--db'
))
# 初始化mysql数据库
common_config
[
"mysql_config"
]
=
mysql_configs
.
get
(
pytestconfig
.
getoption
(
'--db'
))
# 配置登录
StaticGlobal
.
SERVER
=
pytestconfig
.
getoption
(
'--host'
)
@allure.title
(
'极运营登录前置'
)
@allure.title
(
'极运营登录前置'
)
...
...
script/db_config.py
View file @
10cd4ef3
...
@@ -6,11 +6,48 @@ db_configs = {
...
@@ -6,11 +6,48 @@ db_configs = {
"host"
:
'192.168.32.36'
,
"host"
:
'192.168.32.36'
,
"port"
:
5432
"port"
:
5432
},
},
"31"
:
{
'database'
:
'postgres'
,
"user"
:
'dev'
,
"password"
:
'mko0PL<.;?'
,
"host"
:
'192.168.32.31'
,
"port"
:
5432
},
"yf1"
:
{
"yf1"
:
{
'database'
:
'edu-admin'
,
'database'
:
'edu-admin'
,
"user"
:
'
read_user
'
,
"user"
:
'
postgres
'
,
"password"
:
'
c5JJUqmtTeaSaOTN2gs7
'
,
"password"
:
'
bnryQXJTO1fTPTvJpgeF
'
,
"host"
:
'132.232.15.12'
,
"host"
:
'132.232.15.12'
,
"port"
:
5432
"port"
:
5432
}
}
}
}
mysql_configs
=
{
"31"
:
{
'database'
:
''
,
'user'
:
'root'
,
'password'
:
'mysqlLan2vWfdstv8'
,
'host'
:
'192.168.32.31'
,
'port'
:
3306
},
"36"
:
{
'database'
:
''
,
'user'
:
'root'
,
'password'
:
'mysqlLan2vWfdstv8'
,
'host'
:
'192.168.32.36'
,
'port'
:
3306
},
"94"
:
{
'database'
:
''
,
'user'
:
'root'
,
'password'
:
'mysqlLan2vWfdstv8'
,
'host'
:
'172.10.62.94'
,
'port'
:
3306
},
"yf1"
:
{
'database'
:
''
,
'user'
:
'root'
,
'password'
:
'mysqlLan2vWfdstv8'
,
'host'
:
'yf1.jksxb.cn'
,
'port'
:
3306
}
}
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_choose_class/test_auth_choose_class.py
View file @
10cd4ef3
This diff is collapsed.
Click to expand it.
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_choose_class/test_auth_choose_class_details.py
View file @
10cd4ef3
...
@@ -8,7 +8,7 @@ from script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_
...
@@ -8,7 +8,7 @@ from script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_
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
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_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_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_crm.xin_student
s.xin_create_studens
import
CrmCreateStudents
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_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_class_handle.xin_delete_class
import
DeleteClass
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_class_handle.xin_update_class
import
UpdateClass
...
@@ -25,22 +25,18 @@ class TestAuthChoseClassDetails:
...
@@ -25,22 +25,18 @@ class TestAuthChoseClassDetails:
self
.
server
=
StaticGlobal
.
SERVER
self
.
server
=
StaticGlobal
.
SERVER
self
.
schoolArea
=
StaticGlobal
.
SCHOOL
self
.
schoolArea
=
StaticGlobal
.
SCHOOL
self
.
studentPho
=
'145'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
S
%
f'
)
self
.
studentPho
=
'145'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
S
%
f'
)
students_data
=
Cr
eateStudent
(
server
=
self
.
server
,
contactInf
o
=
self
.
studentPho
)
.
create_student
()
students_data
=
Cr
mCreateStudents
(
server
=
self
.
server
,
studentPrimPhoneN
o
=
self
.
studentPho
)
.
create_student
()
self
.
userId
=
students_data
[
'data'
][
'
list'
][
0
][
'
studentId'
]
self
.
userId
=
students_data
[
'data'
][
'studentId'
]
"""
"""
购买一个常规班
购买一个常规班
"""
"""
course_id
=
CreateCourse
(
server
=
self
.
server
,
course_id
=
CreateCourse
(
server
=
self
.
server
,
classType
=
'极趣班'
,
classType
=
'极趣班'
,
courseType
=
'常规班课'
,
courseType
=
'常规班课'
,
productType
=
'主线课程'
,
productType
=
'主线课程'
)
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
year
=
StaticGlobal
.
YEAR
,
term
=
StaticGlobal
.
TERM
,
courseNumber
=
1
,
totalPrice
=
10
)
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
self
.
class_id
=
CreateClass
(
server
=
self
.
server
,
courseId
=
course_id
,
schoolArea
=
self
.
schoolArea
)
.
create_class
()[
'classId'
]
self
.
class_id
=
CreateClass
(
server
=
self
.
server
,
courseId
=
course_id
,
schoolArea
=
self
.
schoolArea
)
.
create_class
()[
'classId'
]
NetWork
(
server
=
self
.
server
,
resignClassIds
=
[
self
.
class_id
])
.
network_set
()
NetWork
(
server
=
self
.
server
,
resignClassIds
=
[
self
.
class_id
])
.
network_set
()
order_id
=
SaveOrder
(
server
=
self
.
server
,
studentId
=
self
.
userId
,
amount
=
10
,
details
=
[{
order_id
=
SaveOrder
(
server
=
self
.
server
,
studentId
=
self
.
userId
,
amount
=
10
0
,
details
=
[{
"classId"
:
self
.
class_id
,
"classId"
:
self
.
class_id
,
"num"
:
10
,
"num"
:
10
,
"discountId"
:
""
,
"discountId"
:
""
,
...
@@ -49,7 +45,7 @@ class TestAuthChoseClassDetails:
...
@@ -49,7 +45,7 @@ class TestAuthChoseClassDetails:
PayOrder
(
server
=
self
.
server
,
orderId
=
order_id
,
payInfos
=
[
PayOrder
(
server
=
self
.
server
,
orderId
=
order_id
,
payInfos
=
[
{
{
"payChannel"
:
"CASH"
,
"payChannel"
:
"CASH"
,
"payAmount"
:
10
"payAmount"
:
10
0
}
}
])
.
pay_order
()
])
.
pay_order
()
time
.
sleep
(
3
)
time
.
sleep
(
3
)
...
@@ -222,8 +218,31 @@ class TestAuthSectionClassDetails:
...
@@ -222,8 +218,31 @@ class TestAuthSectionClassDetails:
self
.
server
=
StaticGlobal
.
SERVER
self
.
server
=
StaticGlobal
.
SERVER
self
.
schoolArea
=
StaticGlobal
.
SCHOOL
self
.
schoolArea
=
StaticGlobal
.
SCHOOL
self
.
studentPho
=
'145'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
S
%
f'
)
self
.
studentPho
=
'145'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
S
%
f'
)
students_data
=
CreateStudent
(
server
=
self
.
server
,
contactInfo
=
self
.
studentPho
)
.
create_student
()
students_data
=
CrmCreateStudents
(
server
=
self
.
server
,
studentPrimPhoneNo
=
self
.
studentPho
)
.
create_student
()
self
.
userId
=
students_data
[
'data'
][
'list'
][
0
][
'studentId'
]
self
.
userId
=
students_data
[
'data'
][
'studentId'
]
"""
购买一个常规班
"""
course_id
=
CreateCourse
(
server
=
self
.
server
,
classType
=
'极趣班'
,
courseType
=
'常规班课'
,
productType
=
'主线课程'
)
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
self
.
class_id
=
CreateClass
(
server
=
self
.
server
,
courseId
=
course_id
,
schoolArea
=
self
.
schoolArea
)
.
create_class
()[
'classId'
]
NetWork
(
server
=
self
.
server
,
resignClassIds
=
[
self
.
class_id
])
.
network_set
()
order_id
=
SaveOrder
(
server
=
self
.
server
,
studentId
=
self
.
userId
,
amount
=
100
,
details
=
[{
"classId"
:
self
.
class_id
,
"num"
:
100
,
"discountId"
:
""
,
"category"
:
"CLASS"
}])
.
save_order
()[
'data'
]
PayOrder
(
server
=
self
.
server
,
orderId
=
order_id
,
payInfos
=
[
{
"payChannel"
:
"CASH"
,
"payAmount"
:
10
}
])
.
pay_order
()
time
.
sleep
(
3
)
# 获取当前时间后14天为分段上的结束时间
# 获取当前时间后14天为分段上的结束时间
start_time
=
datetime
.
datetime
.
now
()
+
timedelta
(
days
=
14
)
start_time
=
datetime
.
datetime
.
now
()
+
timedelta
(
days
=
14
)
...
...
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_choose_class/test_auth_update_choose_class.py
View file @
10cd4ef3
...
@@ -10,6 +10,7 @@ from script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_
...
@@ -10,6 +10,7 @@ from script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_
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_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_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_crm.xin_student
import
CreateStudent
from
script.xin_project_patriarch_app.xin_static.xin_crm.xin_students.xin_create_studens
import
CrmCreateStudents
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_add_class
import
CreateClass
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_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_course_handle.xin_course
import
CreateCourse
...
@@ -25,8 +26,8 @@ class TestAuthUpdateChooseClass:
...
@@ -25,8 +26,8 @@ class TestAuthUpdateChooseClass:
self
.
server
=
StaticGlobal
.
SERVER
self
.
server
=
StaticGlobal
.
SERVER
self
.
schoolArea
=
StaticGlobal
.
SCHOOL
self
.
schoolArea
=
StaticGlobal
.
SCHOOL
self
.
studentPho
=
'189'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
d
%
H
%
M
%
S'
)
self
.
studentPho
=
'189'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
d
%
H
%
M
%
S'
)
students_data
=
Cr
eateStudent
(
server
=
self
.
server
,
contactInf
o
=
self
.
studentPho
)
.
create_student
()
students_data
=
Cr
mCreateStudents
(
server
=
self
.
server
,
studentPrimPhoneN
o
=
self
.
studentPho
)
.
create_student
()
self
.
userId
=
students_data
[
'data'
][
'
list'
][
0
][
'
studentId'
]
self
.
userId
=
students_data
[
'data'
][
'studentId'
]
"""
"""
购买一个常规班
购买一个常规班
"""
"""
...
...
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_purchase_class/test_auth_add_purchase.py
View file @
10cd4ef3
...
@@ -15,7 +15,7 @@ from script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_
...
@@ -15,7 +15,7 @@ from script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_
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
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_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_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_crm.xin_student
s.xin_create_studens
import
CrmCreateStudents
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_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_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_course
import
CreateCourse
...
@@ -37,8 +37,30 @@ class TestAuthAddClassToPurchase:
...
@@ -37,8 +37,30 @@ class TestAuthAddClassToPurchase:
self
.
schoolArea
=
StaticGlobal
.
SCHOOL
self
.
schoolArea
=
StaticGlobal
.
SCHOOL
# 新建一个学生
# 新建一个学生
self
.
studentPho
=
'189'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
d
%
H
%
M
%
S'
)
self
.
studentPho
=
'189'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
d
%
H
%
M
%
S'
)
students_data
=
CreateStudent
(
server
=
self
.
server
,
contactInfo
=
self
.
studentPho
)
.
create_student
()
students_data
=
CrmCreateStudents
(
server
=
self
.
server
,
studentPrimPhoneNo
=
self
.
studentPho
)
.
create_student
()
self
.
userId
=
students_data
[
'data'
][
'list'
][
0
][
'studentId'
]
self
.
userId
=
students_data
[
'data'
][
'studentId'
]
course_id
=
CreateCourse
(
server
=
self
.
server
,
classType
=
'专题'
,
courseType
=
'专题班课'
,
productType
=
'副线课程'
,
year
=
StaticGlobal
.
YEAR
,
term
=
StaticGlobal
.
TERM
)
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
self
.
class_id
=
CreateClass
(
server
=
self
.
server
,
courseId
=
course_id
,
schoolArea
=
self
.
schoolArea
)
.
create_class
()[
'classId'
]
order_id
=
SaveOrder
(
server
=
self
.
server
,
studentId
=
self
.
userId
,
amount
=
100
,
details
=
[{
"classId"
:
self
.
class_id
,
"num"
:
10
,
"discountId"
:
""
,
"category"
:
"CLASS"
}])
.
save_order
()[
'data'
]
PayOrder
(
server
=
self
.
server
,
orderId
=
order_id
,
payInfos
=
[
{
"payChannel"
:
"CASH"
,
"payAmount"
:
100
}
])
.
pay_order
()
time
.
sleep
(
3
)
self
.
header
=
AuthHeaders
(
server
=
self
.
server
,
username
=
self
.
studentPho
)
.
get_auth_headers
()
self
.
header
=
AuthHeaders
(
server
=
self
.
server
,
username
=
self
.
studentPho
)
.
get_auth_headers
()
@allure.story
(
'加入购课单'
)
@allure.story
(
'加入购课单'
)
...
@@ -121,8 +143,8 @@ class TestAuthAddClassToPurchase:
...
@@ -121,8 +143,8 @@ class TestAuthAddClassToPurchase:
def
test_full_class_add_purchase
(
self
):
def
test_full_class_add_purchase
(
self
):
# 新建一个学生报班,让班级满员
# 新建一个学生报班,让班级满员
studentPho_two
=
'189'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
d
%
H
%
M
%
S'
)
studentPho_two
=
'189'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
d
%
H
%
M
%
S'
)
students_data_two
=
Cr
eateStudent
(
server
=
self
.
server
,
contactInf
o
=
studentPho_two
)
.
create_student
()
students_data_two
=
Cr
mCreateStudents
(
server
=
self
.
server
,
studentPrimPhoneN
o
=
studentPho_two
)
.
create_student
()
userId_two
=
students_data_two
[
'data'
][
'
list'
][
0
][
'
studentId'
]
userId_two
=
students_data_two
[
'data'
][
'studentId'
]
# header_two = AuthHeaders(server=self.server, username=self.studentPho).get_auth_headers()
# header_two = AuthHeaders(server=self.server, username=self.studentPho).get_auth_headers()
# 新建一个班级
# 新建一个班级
course_id
=
CreateCourse
(
server
=
self
.
server
,
course_id
=
CreateCourse
(
server
=
self
.
server
,
...
...
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_students_class/test_auth_classes.py
View file @
10cd4ef3
This diff is collapsed.
Click to expand it.
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_students_class/test_auth_completion_class.py
View file @
10cd4ef3
...
@@ -14,7 +14,7 @@ from script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_
...
@@ -14,7 +14,7 @@ from script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_
from
script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_query_class.xin_auth_class
import
QueryClass
from
script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_query_class.xin_auth_class
import
QueryClass
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_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_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_crm.xin_student
s.xin_create_studens
import
CrmCreateStudents
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_add_class
import
CreateClass
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_class_handle.xin_class_attendances.xin_attendances_class
import
AttendancesClass
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_class_handle.xin_class_attendances.xin_attendances_class
import
AttendancesClass
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_class_handle.xin_class_schedules.xin_query_class_schedules
import
QueryClassSchedules
from
script.xin_project_patriarch_app.xin_static.xin_educational.xin_class_handle.xin_class_schedules.xin_query_class_schedules
import
QueryClassSchedules
...
@@ -35,9 +35,9 @@ class TestStudentsCompletionClass:
...
@@ -35,9 +35,9 @@ class TestStudentsCompletionClass:
def
setup_class
(
self
):
def
setup_class
(
self
):
self
.
server
=
StaticGlobal
.
SERVER
self
.
server
=
StaticGlobal
.
SERVER
self
.
studentPho
=
'133'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
S
%
f'
)
self
.
studentPho
=
'133'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
S
%
f'
)
students_data
=
CreateStudent
(
server
=
self
.
server
,
contactInfo
=
self
.
studentPho
)
.
create_student
()
#
students_data = CreateStudent(server=self.server, contactInfo=self.studentPho).create_student()
s
elf
.
userId
=
students_data
[
'data'
][
'list'
][
0
][
'studentId'
]
s
tudents_data
=
CrmCreateStudents
(
server
=
self
.
server
,
studentPrimPhoneNo
=
self
.
studentPho
)
.
create_student
()
self
.
headers
=
AuthHeaders
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
password
=
'geek1234'
)
.
get_auth_headers
()
self
.
userId
=
students_data
[
'data'
][
'studentId'
]
self
.
create_class_data
=
[
self
.
create_class_data
=
[
[
'主线课程'
,
'极趣班'
,
'常规班课'
,
'数学'
,
'1'
,
'1'
,
10
,
'三年级'
,
9384
,
17623669485
],
[
'主线课程'
,
'极趣班'
,
'常规班课'
,
'数学'
,
'1'
,
'1'
,
10
,
'三年级'
,
9384
,
17623669485
],
...
@@ -118,9 +118,11 @@ class TestStudentsCompletionClass:
...
@@ -118,9 +118,11 @@ class TestStudentsCompletionClass:
schedules_id
=
schedules_id
,
schedules_id
=
schedules_id
,
username
=
self
.
create_class_data
[
self
.
class_list
.
index
(
classes_list
)][
9
],
username
=
self
.
create_class_data
[
self
.
class_list
.
index
(
classes_list
)][
9
],
student_id
=
self
.
userId
,
student_id
=
self
.
userId
,
student_name
=
'小黄测试学生
三年级
'
student_name
=
'小黄测试学生'
)
.
attendances_class
()
)
.
attendances_class
()
self
.
headers
=
AuthHeaders
(
server
=
self
.
server
,
username
=
self
.
studentPho
)
.
get_auth_headers
()
@allure.story
(
'学生结业班级列表'
)
@allure.story
(
'学生结业班级列表'
)
@allure.title
(
'学生结业七天内,查询结业班级'
)
@allure.title
(
'学生结业七天内,查询结业班级'
)
@allure.description
(
'学生结业七天内,查询结业班级为空'
)
@allure.description
(
'学生结业七天内,查询结业班级为空'
)
...
...
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_students_class/test_auth_students_classes.py
View file @
10cd4ef3
...
@@ -8,7 +8,7 @@ from script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_
...
@@ -8,7 +8,7 @@ from script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_
from
script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_query_class.xin_query_students_class
import
QueryStudentsClass
from
script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_query_class.xin_query_students_class
import
QueryStudentsClass
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_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_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_crm.xin_student
s.xin_create_studens
import
CrmCreateStudents
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_add_class
import
CreateClass
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_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_course_handle.xin_course
import
CreateCourse
...
@@ -24,8 +24,8 @@ class TestAuthStudentsClassMessage:
...
@@ -24,8 +24,8 @@ class TestAuthStudentsClassMessage:
def
setup_class
(
self
):
def
setup_class
(
self
):
self
.
server
=
StaticGlobal
.
SERVER
self
.
server
=
StaticGlobal
.
SERVER
self
.
studentPho
=
'167'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
S
%
f'
)
self
.
studentPho
=
'167'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
S
%
f'
)
students_data
=
Cr
eateStudent
(
server
=
self
.
server
,
contactInf
o
=
self
.
studentPho
)
.
create_student
()
students_data
=
Cr
mCreateStudents
(
server
=
self
.
server
,
studentPrimPhoneN
o
=
self
.
studentPho
)
.
create_student
()
self
.
userId
=
students_data
[
'data'
][
'
list'
][
0
][
'
studentId'
]
self
.
userId
=
students_data
[
'data'
][
'studentId'
]
self
.
course_id
=
CreateCourse
(
server
=
self
.
server
,
self
.
course_id
=
CreateCourse
(
server
=
self
.
server
,
productType
=
'主线课程'
,
productType
=
'主线课程'
,
classType
=
'极趣班'
,
classType
=
'极趣班'
,
...
...
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_students_login/test_auth_login.py
View file @
10cd4ef3
import
datetime
import
time
import
allure
import
allure
import
pytest
import
pytest
from
pytest_assume.plugin
import
assume
from
pytest_assume.plugin
import
assume
from
common.connect_db
import
OperationDb
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
from
script.xin_project_patriarch_app.xin_static.xin_crm.xin_student
import
CreateStudent
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_students.xin_create_studens
import
CrmCreateStudents
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_course_handle.xin_course
import
CreateCourse
from
script.xin_project_patriarch_app.xin_static.xin_service_user.xin_employees
import
UpdateEmployees
from
script.xin_project_patriarch_app.xin_static.xin_service_user.xin_employees
import
UpdateEmployees
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
...
@@ -15,50 +23,111 @@ class TestAuthLogin:
...
@@ -15,50 +23,111 @@ class TestAuthLogin:
def
setup_class
(
self
):
def
setup_class
(
self
):
self
.
server
=
StaticGlobal
.
SERVER
self
.
server
=
StaticGlobal
.
SERVER
UpdateEmployees
(
server
=
self
.
server
)
.
update_employees
()
UpdateEmployees
(
server
=
self
.
server
)
.
update_employees
()
self
.
studentPho
=
'13364004418'
self
.
studentPho
=
'133'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
S
%
f'
)
CreateStudent
(
server
=
self
.
server
,
contactInfo
=
self
.
studentPho
)
.
create_student
()
# 新建学生
CrmCreateStudents
(
server
=
self
.
server
,
studentPrimPhoneNo
=
self
.
studentPho
)
.
create_student
()
@allure.story
(
'登录验证'
)
@allure.story
(
'
学生未买班,
登录验证'
)
@allure.title
(
'用户名密码正确'
)
@allure.title
(
'
学生未购买过班级,
用户名密码正确'
)
@allure.description
(
'用户名密码正确,登录成功'
)
@allure.description
(
'用户名密码正确,登录成功'
)
@allure.step
(
'输入用户名:13364004418,密码:geek1234'
)
def
test_login01
(
self
):
def
test_login01
(
self
):
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
'13364004418'
,
password
=
'geek1234
'
)
.
get_auth_token
()
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
password
=
'88888888
'
)
.
get_auth_token
()
with
assume
:
assert
auth_data
.
get
(
'code'
)
==
0
with
assume
:
assert
auth_data
.
get
(
'code'
)
==
10081000
0
with
assume
:
assert
auth_data
.
get
(
'msg'
)
==
'
成功
'
with
assume
:
assert
auth_data
.
get
(
'msg'
)
==
'
APP仅针对极客学员开放,请使用报名预留手机号获取验证码
'
@allure.story
(
'登录验证'
)
@allure.story
(
'
学生未买班,
登录验证'
)
@allure.title
(
'用户名正确,密码不正确'
)
@allure.title
(
'
学生未购买过班级,
用户名正确,密码不正确'
)
@allure.description
(
'用户名正确,密码不正确,登录失败'
)
@allure.description
(
'用户名正确,密码不正确,登录失败'
)
@allure.step
(
'输入用户名:13364004418,密码:123'
)
def
test_login02
(
self
):
def
test_login02
(
self
):
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
'13364004418'
,
password
=
'123'
)
.
get_auth_token
()
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
password
=
'123'
)
.
get_auth_token
()
with
assume
:
assert
auth_data
.
get
(
'code'
)
!=
0
with
assume
:
assert
auth_data
.
get
(
'code'
)
==
10081000
0
with
assume
:
assert
auth_data
.
get
(
'msg'
)
==
'用户
名或密码错误!
'
with
assume
:
assert
auth_data
.
get
(
'msg'
)
==
'用户
不存在或者密码错误,请重新输入。
'
@allure.story
(
'登录验证'
)
@allure.story
(
'
学生未买班,
登录验证'
)
@allure.title
(
'用户名错误,密码正确'
)
@allure.title
(
'
学生未购买过班级,
用户名错误,密码正确'
)
@allure.description
(
'用户名错误,密码正确,登录失败'
)
@allure.description
(
'用户名错误,密码正确,登录失败'
)
@allure.step
(
'输入用户名:11111111111,密码:geek1234'
)
def
test_login03
(
self
):
def
test_login03
(
self
):
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
'11111111111'
,
password
=
'geek1234'
)
.
get_auth_token
()
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
'11111111111'
,
password
=
'geek1234'
)
.
get_auth_token
()
with
assume
:
assert
auth_data
.
get
(
'code'
)
!=
0
with
assume
:
assert
auth_data
.
get
(
'code'
)
==
10081000
0
with
assume
:
assert
'该手机号未注册'
in
auth_data
.
get
(
'msg'
)
with
assume
:
assert
auth_data
.
get
(
'msg'
)
==
'用户不存在或者密码错误,请重新输入。'
@allure.story
(
'登录验证'
)
@allure.story
(
'
学生未买班,
登录验证'
)
@allure.title
(
'用户名密码为空'
)
@allure.title
(
'用户名密码为空'
)
@allure.description
(
'用户名密码为空,登录失败'
)
@allure.description
(
'用户名密码为空,登录失败'
)
@allure.step
(
'接口不传用户名和密码'
)
def
test_login04
(
self
):
def
test_login04
(
self
):
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
' '
,
password
=
' '
)
.
get_auth_token
()
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
' '
,
password
=
' '
)
.
get_auth_token
()
with
assume
:
assert
auth_data
.
get
(
'code'
)
!=
0
with
assume
:
assert
auth_data
.
get
(
'code'
)
==
100110001
with
assume
:
assert
'该手机号未注册'
in
auth_data
.
get
(
'msg'
)
with
assume
:
assert
'账号不能为空'
in
auth_data
.
get
(
'msg'
)
with
assume
:
assert
'密码不能为空'
in
auth_data
.
get
(
'msg'
)
@allure.story
(
'登录验证'
)
@allure.story
(
'
学生未买班,
登录验证'
)
@allure.title
(
'用户名为中文,密码正确'
)
@allure.title
(
'用户名为中文,密码正确'
)
@allure.description
(
'用户名为中文,密码正确,登录失败'
)
@allure.description
(
'用户名为中文,密码正确,登录失败'
)
@allure.step
(
'用户名为中文,密码正确'
)
def
test_login05
(
self
):
def
test_login05
(
self
):
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
'这是中文'
,
password
=
'geek1234'
)
.
get_auth_token
()
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
'这是中文'
,
password
=
'geek1234'
)
.
get_auth_token
()
with
assume
:
assert
auth_data
.
get
(
'code'
)
!=
0
with
assume
:
assert
auth_data
.
get
(
'code'
)
==
100810000
with
assume
:
assert
'该手机号未注册'
in
auth_data
.
get
(
'msg'
)
with
assume
:
assert
auth_data
.
get
(
'msg'
)
==
'用户不存在或者密码错误,请重新输入。'
@allure.epic
(
'家长APP接口自动化测试'
)
@allure.feature
(
'登录模块'
)
class
TestAuthBuyClassAndLogin
:
def
setup_class
(
self
):
self
.
server
=
StaticGlobal
.
SERVER
self
.
studentPho
=
'133'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
S
%
f'
)
# 新建学生
students_data
=
CrmCreateStudents
(
server
=
self
.
server
,
studentPrimPhoneNo
=
self
.
studentPho
)
.
create_student
()
self
.
userId
=
students_data
[
'data'
][
'studentId'
]
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
)
.
create_class
()[
'classId'
]
order_id
=
SaveOrder
(
server
=
self
.
server
,
studentId
=
self
.
userId
,
amount
=
100
,
details
=
[{
"classId"
:
class_id
,
"num"
:
10
,
"discountId"
:
""
,
"category"
:
"CLASS"
}])
.
save_order
()[
'data'
]
# 购买该班级
PayOrder
(
server
=
self
.
server
,
orderId
=
order_id
,
payInfos
=
[
{
"payChannel"
:
"CASH"
,
"payAmount"
:
100
}
])
.
pay_order
()
# 因为入班要走MQ,所以要停留
time
.
sleep
(
2
)
@allure.story
(
'学生已购买班级,登录验证'
)
@allure.title
(
'学生已购买班级,用户名密码正确'
)
@allure.description
(
'用户名密码正确,登录成功'
)
def
test_login06
(
self
):
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
password
=
'88888888'
)
.
get_auth_token
()
with
assume
:
assert
auth_data
.
get
(
'code'
)
==
0
with
assume
:
assert
auth_data
.
get
(
'msg'
)
==
'成功'
@allure.story
(
'学生已购买班级,登录验证'
)
@allure.title
(
'学生已购买班级,密码错误'
)
@allure.description
(
'用户名正确,密码不正确,登录失败'
)
def
test_login07
(
self
):
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
password
=
'12345678'
)
.
get_auth_token
()
with
assume
:
assert
auth_data
.
get
(
'code'
)
==
100810000
with
assume
:
assert
auth_data
.
get
(
'msg'
)
==
'用户不存在或者密码错误,请重新输入。'
@allure.story
(
'学生已购买班级,登录验证'
)
@allure.title
(
'极课好学的学生,购买了班级'
)
@allure.description
(
'用户名正确,密码正确,登录失败'
)
def
test_login08
(
self
):
# 修改学生的状态为极课好学的学生
update_sql
=
"""
UPDATE service_identity.`user` set user.`status`='jkhx' WHERE `user`.phone = {}
"""
.
format
(
self
.
studentPho
)
OperationDb
.
execute_mysql
(
update_sql
,
Type
=
False
)
auth_data
=
AuthHeaders
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
password
=
'88888888'
)
.
get_auth_token
()
with
assume
:
assert
auth_data
.
get
(
'code'
)
==
100810000
with
assume
:
assert
'极课好学'
in
auth_data
.
get
(
'msg'
)
script/xin_project_patriarch_app/xin_patriarch_app/test_xin_students_login/test_auth_students.py
View file @
10cd4ef3
import
datetime
import
time
import
allure
import
allure
import
jsonpath
import
jsonpath
from
pytest_assume.plugin
import
assume
from
pytest_assume.plugin
import
assume
...
@@ -6,7 +9,11 @@ from script.base_api import app_students_phoneNumber_mobilePhoneNumberBounding_g
...
@@ -6,7 +9,11 @@ from script.base_api import app_students_phoneNumber_mobilePhoneNumberBounding_g
from
script.base_api
import
app_purchaseOrder_studentId_student_count_get
,
app_course_courseNoticeMessage_post
,
app_course_recentClassTime_get
,
examination_app_queryExamination_get
from
script.base_api
import
app_purchaseOrder_studentId_student_count_get
,
app_course_courseNoticeMessage_post
,
app_course_recentClassTime_get
,
examination_app_queryExamination_get
from
script.base_api
import
app_zeGou_queryClassesIsAvailableVideo_post
from
script.base_api
import
app_zeGou_queryClassesIsAvailableVideo_post
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
from
script.xin_project_patriarch_app.xin_patriarch_app.xin_patriach_static.xin_students_message.xin_query_students_message
import
QueryStudentsMessage
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_students.xin_create_studens
import
CrmCreateStudents
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_course_handle.xin_course
import
CreateCourse
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
...
@@ -15,19 +22,46 @@ from script.xin_project_patriarch_app.xin_static.xin_user.xin_patriarch_login im
...
@@ -15,19 +22,46 @@ from script.xin_project_patriarch_app.xin_static.xin_user.xin_patriarch_login im
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
.
studentPho
=
'133'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
S
%
f'
)
students_message
=
QueryStudentsMessage
(
server
=
self
.
server
,
studentPno
=
'13364004418'
)
.
query_students_message
()
# 新建学生
self
.
student_id
=
students_message
.
get
(
'data'
)[
0
]
.
get
(
'student'
)
.
get
(
'id'
)
students_data
=
CrmCreateStudents
(
server
=
self
.
server
,
studentPrimPhoneNo
=
self
.
studentPho
)
.
create_student
()
self
.
student_id
=
students_data
[
'data'
][
'studentId'
]
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
)
.
create_class
()[
'classId'
]
order_id
=
SaveOrder
(
server
=
self
.
server
,
studentId
=
self
.
student_id
,
amount
=
100
,
details
=
[{
"classId"
:
class_id
,
"num"
:
10
,
"discountId"
:
""
,
"category"
:
"CLASS"
}])
.
save_order
()[
'data'
]
# 购买该班级
PayOrder
(
server
=
self
.
server
,
orderId
=
order_id
,
payInfos
=
[
{
"payChannel"
:
"CASH"
,
"payAmount"
:
100
}
])
.
pay_order
()
# 因为入班要走MQ,所以要停留
time
.
sleep
(
2
)
self
.
header
=
AuthHeaders
(
server
=
self
.
server
,
username
=
self
.
studentPho
,
password
=
'88888888'
)
.
get_auth_headers
()
@allure.story
(
'登录成功验证'
)
@allure.story
(
'登录成功验证'
)
@allure.title
(
'验证查询学生信息正确'
)
@allure.title
(
'验证查询学生信息正确'
)
@allure.description
(
'查询学生包含这个学生'
)
@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
=
self
.
studentPho
,
header
=
self
.
header
,
default_assert
=
False
)
# print(students_data)
with
assume
:
assert
students_data
.
get
(
'code'
)
==
0
with
assume
:
assert
students_data
.
get
(
'code'
)
==
0
with
assume
:
assert
'小黄测试学生
三年级
'
in
jsonpath
.
jsonpath
(
students_data
,
'$..name'
)
with
assume
:
assert
'小黄测试学生'
in
jsonpath
.
jsonpath
(
students_data
,
'$..name'
)
for
students
in
jsonpath
.
jsonpath
(
students_data
,
'$...phones'
):
#
for students in jsonpath.jsonpath(students_data, '$...phones'):
with
assume
:
assert
students
==
[
'13364004418'
]
# with assume: assert students == [self.studentPho
]
@allure.story
(
'登录成功验证'
)
@allure.story
(
'登录成功验证'
)
@allure.title
(
'查询学生设备绑定关系'
)
@allure.title
(
'查询学生设备绑定关系'
)
...
...
script/xin_project_patriarch_app/xin_patriarch_app/xin_patriach_static/xin_choose_class/xin_choose_classes.py
View file @
10cd4ef3
...
@@ -60,8 +60,3 @@ class courseDetails:
...
@@ -60,8 +60,3 @@ class courseDetails:
response_data
=
app_class_classId_alternative_studentId_student_get
(
classId
=
self
.
classId
,
studentId
=
self
.
studentId
,
header
=
self
.
headers
,
default_assert
=
False
)
response_data
=
app_class_classId_alternative_studentId_student_get
(
classId
=
self
.
classId
,
studentId
=
self
.
studentId
,
header
=
self
.
headers
,
default_assert
=
False
)
return
response_data
return
response_data
if
__name__
==
'__main__'
:
server_ip
=
'http://172.10.62.94'
return_data
=
courseDetails
(
server
=
server_ip
,
classId
=
100142250
,
studentId
=
10573504
)
.
query_course_details
()
print
(
return_data
)
script/xin_project_patriarch_app/xin_patriarch_app/xin_patriach_static/xin_public_class/xin_global_static.py
View file @
10cd4ef3
from
common.common_config
import
common_config
class
StaticGlobal
:
class
StaticGlobal
:
YEAR
=
2021
YEAR
=
2021
TERM
=
'春'
TERM
=
'春'
SCHOOL
=
3052
SCHOOL
=
3052
SERVER
=
'http
://192.168.32.31
'
SERVER
=
'http
s://yf1.jkwljy.com
'
script/xin_project_patriarch_app/xin_patriarch_app/xin_patriach_static/xin_query_class/xin_query_students_class.py
View file @
10cd4ef3
...
@@ -40,8 +40,3 @@ class QueryStudentsClass:
...
@@ -40,8 +40,3 @@ class QueryStudentsClass:
class_data
=
app_course_getStudentClassDetail_get
(
params
=
self
.
body
,
header
=
self
.
headers
,
default_assert
=
False
)
class_data
=
app_course_getStudentClassDetail_get
(
params
=
self
.
body
,
header
=
self
.
headers
,
default_assert
=
False
)
return
class_data
return
class_data
if
__name__
==
'__main__'
:
server_ip
=
'http://172.10.62.94'
query_data
=
QueryStudentsClass
(
server
=
server_ip
,
studentId
=
10573494
,
classId
=
100142234
,
username
=
13312145220
)
.
query_student_class
()
print
(
query_data
)
script/xin_project_patriarch_app/xin_patriarch_app/xin_patriach_static/xin_students_message/xin_query_students_message.py
View file @
10cd4ef3
...
@@ -22,7 +22,3 @@ class QueryStudentsMessage:
...
@@ -22,7 +22,3 @@ class QueryStudentsMessage:
def
query_students_message
(
self
):
def
query_students_message
(
self
):
students_data
=
students_phoneNumber_mobilePhoneNumberBounding_get
(
phoneNumber
=
self
.
studentPno
,
header
=
self
.
headers
,
default_assert
=
False
)
students_data
=
students_phoneNumber_mobilePhoneNumberBounding_get
(
phoneNumber
=
self
.
studentPno
,
header
=
self
.
headers
,
default_assert
=
False
)
return
students_data
return
students_data
if
__name__
==
'__main__'
:
print
(
QueryStudentsMessage
(
server
=
'http://172.10.62.94'
,
studentPno
=
13312152205
)
.
query_students_message
())
script/xin_project_patriarch_app/xin_static/xin_crm/xin_apply/xin_place_order.py
View file @
10cd4ef3
import
datetime
import
datetime
from
script.base_api
import
student_all_items_post
from
script.base_api.api_operation_web.pay
import
pay_post
from
script.base_api.api_operation_web.pay
import
pay_post
from
script.base_api.api_operation_web.order
import
order_saveOrder_post
from
script.base_api.api_operation_web.order
import
order_saveOrder_post
from
script.xin_project_patriarch_app.xin_static.xin_crm.xin_student
import
CreateStudent
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_course_handle.xin_course
import
CreateCourse
from
script.xin_project_patriarch_app.xin_static.xin_service.xin_service
import
Service_get
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
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
class
PlaceOrder
:
class
PlaceOrder
:
def
__init__
(
self
,
server
,
def
__init__
(
self
,
server
,
header
,
username
=
None
,
username
=
None
,
password
=
None
,
password
=
None
,
studentId
=
None
):
studentId
=
None
,
school_id
=
None
,
classId
=
None
):
self
.
server
=
server
self
.
server
=
server
# self.sava_order_url = '/api-operation-web/order/saveOrder'
# self.sava_order_url = '/api-operation-web/order/saveOrder'
# self.pay_url = '/api-operation-web/pay'
# self.pay_url = '/api-operation-web/pay'
self
.
username
=
username
self
.
username
=
username
self
.
password
=
password
self
.
password
=
password
self
.
studentId
=
studentId
self
.
studentId
=
studentId
self
.
header
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
self
.
password
)
.
get_headers
()
self
.
school_id
=
school_id
self
.
classId
=
classId
self
.
header
=
header
# self.header = Headers(server=self.server, username=self.username, password=self.password).get_headers()
self
.
sava_body
=
{
self
.
sava_body
=
{
"studentId"
:
self
.
studentId
,
"studentId"
:
self
.
studentId
,
"schoolArea"
:
3100
,
"schoolArea"
:
self
.
school_id
or
3100
,
"details"
:
[
"details"
:
[
# {
# {
# "classId": 100141010,
# "classId": 100141010,
...
@@ -30,7 +40,7 @@ class PlaceOrder:
...
@@ -30,7 +40,7 @@ class PlaceOrder:
# "category": "CLASS"
# "category": "CLASS"
# },
# },
{
{
"classId"
:
100141011
,
"classId"
:
self
.
classId
or
100141011
,
"num"
:
10
,
"num"
:
10
,
"discountId"
:
""
,
"discountId"
:
""
,
"category"
:
"CLASS"
"category"
:
"CLASS"
...
@@ -44,33 +54,66 @@ class PlaceOrder:
...
@@ -44,33 +54,66 @@ class PlaceOrder:
}
}
def
price_order
(
self
):
def
price_order
(
self
):
# sava_data = requests.post(url=self.server + self.sava_order_url, json=self.sava_body, headers=self.header, verify=False).json()['data']
try
:
sava_data
=
order_saveOrder_post
(
header
=
self
.
header
,
body
=
self
.
sava_body
,
params
=
'recommit-ticket=undefined'
,
default_assert
=
False
)[
'data'
]
# sava_data = requests.post(url=self.server + self.sava_order_url, json=self.sava_body, headers=self.header, verify=False).json()['data']
pay_body
=
{
sava_data
=
order_saveOrder_post
(
header
=
self
.
header
,
body
=
self
.
sava_body
,
params
=
'recommit-ticket=undefined'
,
default_assert
=
False
)[
'data'
]
"orderId"
:
str
(
sava_data
),
pay_body
=
{
"operatorId"
:
9384
,
"orderId"
:
str
(
sava_data
),
"operatorType"
:
"STAFF"
,
"operatorId"
:
9384
,
"remark"
:
""
,
"operatorType"
:
"STAFF"
,
"payInfos"
:
[
"remark"
:
""
,
{
"payInfos"
:
[
"payChannel"
:
"CASH"
,
{
"payAmount"
:
100
"payChannel"
:
"CASH"
,
}
"payAmount"
:
100
]
}
}
]
pay_data
=
pay_post
(
body
=
pay_body
,
header
=
self
.
header
)
}
return
pay_data
.
json
()
pay_data
=
pay_post
(
body
=
pay_body
,
header
=
self
.
header
)
return
pay_data
except
Exception
as
e
:
print
(
e
)
return
{
'code'
:
-
1
}
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
server_ip
=
Service_get
.
service_content
(
'36'
)
server_ip
=
Service_get
.
service_content
(
'36'
)
for
i
in
range
(
10000
):
schools
=
[{
"area"
:
2390
,
"schoolArea"
:
3148
}]
studentName
=
'小黄测试学生'
+
str
(
i
)
studentPho
=
'133'
+
datetime
.
datetime
.
now
()
.
strftime
(
'
%
d
%
H
%
M
%
S'
)
query_student
=
{
"schoolAreaIds"
:
[
3100
,
2391
,
2392
,
2403
,
2412
,
2413
,
3046
,
3148
,
3352
,
3376
,
3377
,
2402
,
2404
,
2405
,
2406
,
2411
,
3067
],
"studentStatus"
:
1110
,
"year"
:
2021
,
"term"
:
"暑"
,
"courseType"
:
""
,
student_id
=
CreateStudent
(
server
=
server_ip
,
studentName
=
studentName
,
publicGrade
=
'五年级'
,
contactInfo
=
studentPho
)
.
create_student
()[
'data'
][
'list'
][
0
][
'studentId'
]
"pageNum"
:
1
,
print
(
f
"{studentName}-->学生创建成功!"
)
"pageSize"
:
20000
}
place_order
=
PlaceOrder
(
server
=
server_ip
,
studentId
=
student_id
)
.
price_order
()
headers
=
Headers
(
server
=
server_ip
)
.
get_headers
()
all_student
=
student_all_items_post
(
body
=
query_student
,
header
=
headers
)
.
get
(
'data'
)
.
get
(
'list'
)
count
=
0
class_id
=
''
for
students
in
all_student
:
if
count
%
10
==
0
:
course_id
=
CreateCourse
(
server
=
server_ip
,
classType
=
'五四极趣班'
,
courseType
=
'常规班课'
,
productType
=
'主线课程'
,
grade
=
'五年级'
,
registerGrade
=
'五年级'
,
term
=
'暑'
,
schools
=
schools
)
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
class_id
=
CreateClass
(
server
=
server_ip
,
courseId
=
course_id
,
schoolArea
=
3148
)
.
create_class
()[
'classId'
]
place_order
=
PlaceOrder
(
server
=
server_ip
,
studentId
=
students
.
get
(
'studentId'
),
school_id
=
3140
,
classId
=
class_id
,
header
=
headers
)
.
price_order
()
if
place_order
[
'code'
]
==
0
and
place_order
[
'msg'
]
==
'成功'
:
if
place_order
[
'code'
]
==
0
and
place_order
[
'msg'
]
==
'成功'
:
print
(
f
"{student
Name
}-->购课成功!"
)
print
(
f
"{student
s.get('studentName')
}-->购课成功!"
)
else
:
else
:
print
(
f
"{studentName}-->购课失败!{place_order}"
)
print
(
f
"{students.get('studentName')}-->购课失败!{place_order}"
)
count
+=
1
# for j in range(10):
# studentName = '小黄测试学生' + str(i)
# studentPho = '133' + datetime.datetime.now().strftime('%d%H%M%S')
# student_id = CreateStudent(server=server_ip, studentName=studentName, publicGrade='六年级', contactInfo=studentPho, createSchoolAreaId=3148).create_student()['data']['list'][0]['studentId']
# print(f"{studentName}-->学生创建成功!")
# place_order = PlaceOrder(server=server_ip, studentId=student_id, school_id=3140, classId=class_id).price_order()
# if place_order['code'] == 0 and place_order['msg'] == '成功':
# print(f"{studentName}-->购课成功!")
# else:
# print(f"{studentName}-->购课失败!{place_order}")
script/xin_project_patriarch_app/xin_static/xin_crm/xin_student.py
View file @
10cd4ef3
...
@@ -185,7 +185,3 @@ class DeleteStudent:
...
@@ -185,7 +185,3 @@ class DeleteStudent:
# delete_data = requests.delete(url=self.server + delete_url, json=self.student, headers=self.header, verify=False)
# delete_data = requests.delete(url=self.server + delete_url, json=self.student, headers=self.header, verify=False)
return
delete_data
.
json
()
return
delete_data
.
json
()
if
__name__
==
'__main__'
:
print
(
CreateStudent
(
server
=
Service_get
.
service_content
(
'94'
),
studentName
=
'阿黄测试11'
)
.
create_student
())
# print(DeleteStudent(server=Service_get.service_content('94'), student=[377963]).delete_student())
script/xin_project_patriarch_app/xin_static/xin_crm/xin_students/__init__.py
0 → 100644
View file @
10cd4ef3
"""
@encoding: utf-8
@Author: LiuHangXin
@Time: 2021/5/19
"""
script/xin_project_patriarch_app/xin_static/xin_crm/xin_students/xin_create_studens.py
0 → 100644
View file @
10cd4ef3
"""
@encoding: utf-8
@Author: LiuHangXin
@Time: 2021/5/19
"""
import
allure
import
requests
from
common.connect_db
import
OperationDb
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
"""
报名-新建学生
"""
class
CrmCreateStudents
:
def
__init__
(
self
,
server
,
**
kwargs
):
self
.
server
=
server
self
.
username
=
kwargs
.
get
(
'username'
)
self
.
password
=
kwargs
.
get
(
'password'
)
self
.
url
=
'/api-operation-web/student/add'
self
.
body
=
{
"studentName"
:
kwargs
.
get
(
'studentName'
)
or
"小黄测试学生"
,
"studentSex"
:
kwargs
.
get
(
'studentSex'
)
or
"-"
,
"studentSource"
:
kwargs
.
get
(
'studentSource'
)
or
"营销活动"
,
"sourceIdFirst"
:
kwargs
.
get
(
'sourceIdFirst'
)
or
102
,
"studentPrimPhoneNo"
:
kwargs
.
get
(
'studentPrimPhoneNo'
)
or
'13364004418'
,
"primBelong"
:
kwargs
.
get
(
'primBelong'
)
or
"外婆"
,
"studentSecondaryPhoneNo"
:
kwargs
.
get
(
'studentSecondaryPhoneNo'
)
or
""
,
"secondaryBelong"
:
kwargs
.
get
(
'secondaryBelong'
)
or
""
,
"attendSchoolId"
:
kwargs
.
get
(
'attendSchoolId'
)
or
13130
,
"attendSchool"
:
kwargs
.
get
(
'attendSchool'
)
or
"成都市草堂小学子美分校"
,
"attendGrade"
:
kwargs
.
get
(
'attendGrade'
)
or
"三年级"
,
"attendClass"
:
kwargs
.
get
(
'attendClass'
)
or
""
,
"attendTeacher"
:
kwargs
.
get
(
'attendTeacher'
)
or
""
,
"birthday"
:
kwargs
.
get
(
'birthday'
)
or
""
,
"introducer"
:
kwargs
.
get
(
'introducer'
)
or
""
,
"introducerId"
:
kwargs
.
get
(
'introducerId'
)
or
""
,
"introducerNo"
:
kwargs
.
get
(
'introducerNo'
)
or
""
,
"homeProvinceId"
:
kwargs
.
get
(
'homeProvinceId'
)
or
""
,
"homeCityId"
:
kwargs
.
get
(
'homeCityId'
)
or
""
,
"homeDistrictId"
:
kwargs
.
get
(
'homeDistrictId'
)
or
""
,
"homeCountyId"
:
kwargs
.
get
(
'homeCountyId'
)
or
""
,
"homeAddress"
:
kwargs
.
get
(
'homeAddress'
)
or
""
,
"city"
:
kwargs
.
get
(
'city'
)
or
510100
,
"entrancePaper"
:
kwargs
.
get
(
'entrancePaper'
)
or
""
,
"score"
:
kwargs
.
get
(
'score'
)
or
""
,
"schoolArea"
:
kwargs
.
get
(
'schoolArea'
)
or
3052
,
"remark"
:
kwargs
.
get
(
'remark'
)
or
""
,
"primUserId"
:
kwargs
.
get
(
'primUserId'
)
or
""
,
"secondUserId"
:
kwargs
.
get
(
'secondUserId'
)
or
""
,
"firstUserPhone"
:
kwargs
.
get
(
'studentPrimPhoneNo'
)
or
'13364004418'
,
"firstUserIdentity"
:
kwargs
.
get
(
'firstUserIdentity'
)
or
"外婆"
,
"secondUserPhone"
:
kwargs
.
get
(
'secondUserPhone'
)
or
""
,
"secondUserIdentity"
:
kwargs
.
get
(
'secondUserIdentity'
)
or
""
}
self
.
header
=
Headers
(
server
=
self
.
server
,
username
=
self
.
username
,
password
=
self
.
password
)
.
get_headers
()
@allure.step
(
"极运营/报名/新建学生"
)
def
create_student
(
self
):
try
:
student_data
=
requests
.
post
(
url
=
self
.
server
+
self
.
url
,
json
=
self
.
body
,
headers
=
self
.
header
,
verify
=
False
)
.
json
()
# 获取学生的id
studentId
=
student_data
.
get
(
'data'
)
.
get
(
'studentId'
)
# 新建学生没有密码,给学生添加密码
# 查询学生的prim_user_id
student_data_sql
=
"""
select t1.prim_user_id
from service_profile.student t1
where t1.student_id = '{}'
"""
.
format
(
studentId
)
# 修改用户的密码
students
=
OperationDb
.
query_sql
(
student_data_sql
)
# print(students[0][0])
sql_data
=
"""
update service_identity.user_channel_info t2 set credential = '099b83907f50f1ef1e4217692b0a24e027ea2482507470b42fdaca353313ac6ccc8a1597fd4f9187a2063ab3a356095d55aa8b013f583b3811fffa89d79e1696'
where user_id = '{}'
"""
.
format
(
students
[
0
][
0
])
OperationDb
.
execute_mysql
(
sql_data
,
Type
=
False
)
return
student_data
except
Exception
as
e
:
return
str
(
e
)
script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_add_class.py
View file @
10cd4ef3
import
jsonpath
import
jsonpath
from
script.base_api
import
education_classes_add_post
,
education_courses_query_post
,
education_classes_query_post
from
script.base_api
import
education_classes_add_post
,
education_courses_query_post
,
education_classes_query_post
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_service.xin_service
import
Service_get
from
script.xin_project_patriarch_app.xin_static.xin_time
import
Time_get
from
script.xin_project_patriarch_app.xin_static.xin_time
import
Time_get
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
...
@@ -131,8 +129,3 @@ class CreateClass:
...
@@ -131,8 +129,3 @@ class CreateClass:
return
query_class
.
get
(
'data'
)
.
get
(
'list'
)[
0
]
return
query_class
.
get
(
'data'
)
.
get
(
'list'
)[
0
]
else
:
else
:
return
add_class_data
return
add_class_data
if
__name__
==
'__main__'
:
course_id
=
CreateCourse
(
server
=
Service_get
.
service_content
(
'94'
))
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
]
print
(
CreateClass
(
server
=
Service_get
.
service_content
(
'94'
),
courseId
=
course_id
)
.
create_class
()[
'classId'
])
script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_delete_class.py
View file @
10cd4ef3
...
@@ -20,8 +20,3 @@ class DeleteClass:
...
@@ -20,8 +20,3 @@ class DeleteClass:
delete_msg
=
education_classes_delete_post
(
body
=
self
.
classes
,
header
=
self
.
headers
,
default_assert
=
False
)
delete_msg
=
education_classes_delete_post
(
body
=
self
.
classes
,
header
=
self
.
headers
,
default_assert
=
False
)
return
delete_msg
return
delete_msg
if
__name__
==
'__main__'
:
server_ip
=
'http://172.10.62.94'
delete_data
=
DeleteClass
(
server
=
server_ip
,
classes
=
[
100142200
])
.
delete_class
()
print
(
delete_data
)
script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_update_class.py
View file @
10cd4ef3
...
@@ -161,8 +161,3 @@ class UpdateClass:
...
@@ -161,8 +161,3 @@ class UpdateClass:
}
}
return
education_classes_update_post
(
body
=
dict
(
data
,
**
self
.
body
),
header
=
self
.
headers
,
default_assert
=
False
)
return
education_classes_update_post
(
body
=
dict
(
data
,
**
self
.
body
),
header
=
self
.
headers
,
default_assert
=
False
)
if
__name__
==
'__main__'
:
server_ip
=
'http://172.10.62.94'
return_data
=
UpdateClass
(
server
=
server_ip
,
classId
=
100142200
)
.
update_class_schedule
(
'111'
)
print
(
return_data
)
script/xin_project_patriarch_app/xin_static/xin_educational/xin_course_handle/xin_course.py
View file @
10cd4ef3
...
@@ -159,7 +159,3 @@ class DeleteCourse:
...
@@ -159,7 +159,3 @@ class DeleteCourse:
def
delete_course
(
self
):
def
delete_course
(
self
):
delete_data
=
education_courses_delete_post
(
body
=
self
.
course
,
header
=
self
,
default_assert
=
False
,
return_json
=
False
)
delete_data
=
education_courses_delete_post
(
body
=
self
.
course
,
header
=
self
,
default_assert
=
False
,
return_json
=
False
)
return
delete_data
.
json
()
return
delete_data
.
json
()
if
__name__
==
'__main__'
:
print
(
CreateCourse
(
server
=
Service_get
.
service_content
(
'94'
))
.
create_course
()[
'data'
][
'content'
][
0
][
'courseId'
])
script/xin_project_patriarch_app/xin_static/xin_educational/xin_course_handle/xin_update_course.py
View file @
10cd4ef3
...
@@ -206,9 +206,3 @@ class StopOrStartCourse:
...
@@ -206,9 +206,3 @@ class StopOrStartCourse:
def
stop_or_start_course
(
self
):
def
stop_or_start_course
(
self
):
return
education_courses_startOrStop_put
(
body
=
self
.
course_data
,
header
=
self
.
headers
)
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
()
print
(
return_data
)
script/xin_project_patriarch_app/xin_static/xin_service_user/xin_employees.py
View file @
10cd4ef3
...
@@ -24,8 +24,3 @@ class UpdateEmployees:
...
@@ -24,8 +24,3 @@ class UpdateEmployees:
return
update_data
return
update_data
else
:
else
:
return
update_data
return
update_data
if
__name__
==
'__main__'
:
return_data
=
UpdateEmployees
(
'http://172.10.62.94'
)
.
update_employees
()
print
(
return_data
)
script/xin_project_patriarch_app/xin_static/xin_setting/xin_discounts/xin_discounts_coupon.py
View file @
10cd4ef3
...
@@ -147,7 +147,3 @@ class DiscountsCoupon:
...
@@ -147,7 +147,3 @@ class DiscountsCoupon:
self
.
body
.
pop
(
'operator'
)
self
.
body
.
pop
(
'operator'
)
self
.
body
.
pop
(
'issueType'
)
self
.
body
.
pop
(
'issueType'
)
return
requests
.
post
(
url
=
self
.
server
+
edit_url
,
json
=
dict
(
edit_data
,
**
self
.
body
),
headers
=
self
.
header
,
verify
=
False
)
.
json
()
return
requests
.
post
(
url
=
self
.
server
+
edit_url
,
json
=
dict
(
edit_data
,
**
self
.
body
),
headers
=
self
.
header
,
verify
=
False
)
.
json
()
if
__name__
==
'__main__'
:
print
(
DiscountsCoupon
(
server
=
Service_get
.
service_content
(
'94'
),
remark
=
'编辑优惠券'
)
.
edit_discounts_coupon
(
coupon_id
=
11577
))
script/xin_project_patriarch_app/xin_static/xin_setting/xin_discounts/xin_discounts_event.py
View file @
10cd4ef3
...
@@ -193,11 +193,3 @@ class DiscountsEvent:
...
@@ -193,11 +193,3 @@ class DiscountsEvent:
"id"
:
event_id
"id"
:
event_id
}
}
return
requests
.
post
(
url
=
self
.
server
+
edit_url
,
json
=
dict
(
edit_data
,
**
self
.
body
),
headers
=
self
.
header
,
verify
=
False
)
.
json
()
return
requests
.
post
(
url
=
self
.
server
+
edit_url
,
json
=
dict
(
edit_data
,
**
self
.
body
),
headers
=
self
.
header
,
verify
=
False
)
.
json
()
if
__name__
==
'__main__'
:
"""
requests.post(url=self.server + self.url, json=dict(continue_data, **self.body), headers=self.header, verify=False).json()
"""
print
(
DiscountsEvent
(
server
=
Service_get
.
service_content
(
'94'
))
.
edit_discount_event
(
event_id
=
10001562
))
# print(DiscountsEvent(server=Service_get.service_content('94'), discountName='启用').boutique_discounts())
script/xin_project_patriarch_app/xin_static/xin_setting/xin_school.py
View file @
10cd4ef3
import
requests
from
script.base_api
import
departments_school_post
from
script.base_api
import
departments_school_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
from
script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login
import
Headers
...
@@ -58,29 +55,3 @@ class School:
...
@@ -58,29 +55,3 @@ class School:
data
[
'sectionSetting'
]
=
0
data
[
'sectionSetting'
]
=
0
data
.
pop
(
'sectionValue'
)
data
.
pop
(
'sectionValue'
)
return
data
return
data
if
__name__
==
'__main__'
:
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": {
"grade": ["零年级", "一年级"],
"platform": ["app"],
"subject": ["语文", "英语"],
"term": "秋",
"signInTime": ["2021-03-15 00:00:00", "2021-04-14 00:00:00"],
"beginDate": "2021-03-15 00:00:00", "endDate": "2021-04-14 00:00:00"
}
"""
script/xin_project_patriarch_app/xin_static/xin_user/xin_jky_pc_login.py
View file @
10cd4ef3
...
@@ -87,7 +87,3 @@ class Headers:
...
@@ -87,7 +87,3 @@ class Headers:
return
self
.
get_token
(
AddUser
=
True
)
return
self
.
get_token
(
AddUser
=
True
)
except
TypeError
:
except
TypeError
:
return
self
.
get_token
()
return
self
.
get_token
()
if
__name__
==
'__main__'
:
print
(
Headers
(
server
=
'http://172.10.62.94'
)
.
get_headers
())
script/xin_project_patriarch_app/xin_static/xin_user/xin_patriarch_login.py
View file @
10cd4ef3
...
@@ -13,14 +13,14 @@ class AuthHeaders:
...
@@ -13,14 +13,14 @@ class AuthHeaders:
def
__init__
(
self
,
server
,
username
,
password
=
None
):
def
__init__
(
self
,
server
,
username
,
password
=
None
):
self
.
server
=
server
self
.
server
=
server
self
.
username
=
username
self
.
username
=
username
self
.
password
=
password
or
'
geek1234
'
self
.
password
=
password
or
'
88888888
'
self
.
body
=
{
self
.
body
=
{
"account"
:
self
.
username
,
"account"
:
self
.
username
,
"password"
:
self
.
password
,
"password"
:
self
.
password
,
"code"
:
""
,
"code"
:
""
,
"type"
:
"customer"
"type"
:
"customer"
}
}
self
.
url
=
'/
service-user/app/auth
'
self
.
url
=
'/
api-jksxb-app/user/login/by/account
'
"""
"""
获取家长端APP的登录信息
获取家长端APP的登录信息
...
@@ -73,8 +73,3 @@ class AuthHeaders:
...
@@ -73,8 +73,3 @@ class AuthHeaders:
WriteYaml
.
write_yaml_data
(
r'\xin_static\xin_user\patriarch_user'
,
content
)
WriteYaml
.
write_yaml_data
(
r'\xin_static\xin_user\patriarch_user'
,
content
)
# print(headers)
# print(headers)
return
headers
return
headers
if
__name__
==
'__main__'
:
server_ip
=
'http://172.10.62.94'
AuthHeaders
(
server
=
server_ip
,
username
=
'13364004418'
,
password
=
'geek1234'
)
.
get_auth_headers
()
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