Commit bae3d858 authored by 小刘's avatar 小刘

选课中心用例

parent cc3093ad
......@@ -275,7 +275,7 @@ class TestChooseClasses:
@allure.story('选课列表-班级')
@allure.title('购买了副线班,看不到常规班')
@allure.description('学生购买了副线班,不能看到常规班')
@allure.description('学生购买了副线班,不能看到常规班和精品班')
def test_choose_buy_subLine_not_groove(self):
studentPho = '173' + datetime.datetime.now().strftime('%d%H%M%S')
students_data = CreateStudent(server=self.server, contactInfo=studentPho).create_student()
......@@ -296,9 +296,139 @@ class TestChooseClasses:
choose_data = ChooseClasses(server=self.server, studentId=userId, schoolAreaId=self.schoolArea).choose_class()
with assume: assert choose_data['code'] == 0
with assume: assert '极趣班' not in jsonpath.jsonpath(choose_data, '$..classType')
with assume: assert '一对一定制班' not in jsonpath.jsonpath(choose_data, '$..classType')
@allure.story('选课列表-班级')
@allure.title('购买了当期前的常规班,看不到常规班')
@allure.description('购买了当期前的常规班,不能看到常规班和新生班')
@allure.description('购买了当期前的常规班,不能看到常规班、和精品班,能看到新生班')
def test_choose_buy_before_groove_not_now(self):
studentPho = '173' + datetime.datetime.now().strftime('%d%H%M%S')
students_data = CreateStudent(server=self.server, contactInfo=studentPho).create_student()
userId = students_data['data']['list'][0]['studentId']
course_id = CreateCourse(server=self.server,
productType='主线课程',
classType='极趣班',
courseType='常规班课',
year=StaticGlobal.YEAR - 1,
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=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()
time.sleep(2)
choose_data = ChooseClasses(server=self.server, studentId=userId, schoolAreaId=self.schoolArea).choose_class()
with assume: assert choose_data['code'] == 0
with assume: assert '极趣班' not in jsonpath.jsonpath(choose_data, '$..classType')
with assume: assert '新生' in jsonpath.jsonpath(choose_data, '$..classType')
with assume: assert '一对一定制班' not in jsonpath.jsonpath(choose_data, '$..classType')
@allure.story('选课列表-班级')
@allure.title('购买了当期的常规班,可以看到常规班')
@allure.description('购买了当期的常规班,能看到常规班,不能看到新生班和精品班')
def test_choose_buy_now_groove(self):
studentPho = '173' + datetime.datetime.now().strftime('%d%H%M%S')
students_data = CreateStudent(server=self.server, contactInfo=studentPho).create_student()
userId = students_data['data']['list'][0]['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=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()
time.sleep(2)
choose_data = ChooseClasses(server=self.server, studentId=userId, schoolAreaId=self.schoolArea).choose_class()
print(jsonpath.jsonpath(choose_data, '$..classType'))
with assume: assert choose_data['code'] == 0
with assume: assert '极趣班' not in jsonpath.jsonpath(choose_data, '$..classType')
with assume: assert '专题' in jsonpath.jsonpath(choose_data, '$..classType')
with assume: assert '新生' not in jsonpath.jsonpath(choose_data, '$..classType')
with assume: assert '一对一定制班' not in jsonpath.jsonpath(choose_data, '$..classType')
@allure.story('选课列表-班级')
@allure.title('购买了当期后的常规班,看不到常规班')
@allure.description('购买了当期后的常规班,不能看到常规班和精品班,能看到新生班')
def test_choose_buy_after_groove_not_now(self):
with assume: assert 1 == 1
\ No newline at end of file
studentPho = '173' + datetime.datetime.now().strftime('%d%H%M%S')
students_data = CreateStudent(server=self.server, contactInfo=studentPho).create_student()
userId = students_data['data']['list'][0]['studentId']
course_id = CreateCourse(server=self.server,
productType='主线课程',
classType='极趣班',
courseType='常规班课',
year=StaticGlobal.YEAR + 1,
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=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()
time.sleep(2)
choose_data = ChooseClasses(server=self.server, studentId=userId, schoolAreaId=self.schoolArea).choose_class()
with assume: assert choose_data['code'] == 0
with assume: assert '极趣班' not in jsonpath.jsonpath(choose_data, '$..classType')
with assume: assert '新生' in jsonpath.jsonpath(choose_data, '$..classType')
with assume: assert '一对一定制班' not in jsonpath.jsonpath(choose_data, '$..classType')
@allure.story('选课列表-班级')
@allure.title('购买了班级,班级在网报时间内显示已报名标签')
@allure.description('购买班级,班级显示已报名的标签')
def test_choose_buy_show_bought(self):
studentPho = '173' + datetime.datetime.now().strftime('%d%H%M%S')
students_data = CreateStudent(server=self.server, contactInfo=studentPho).create_student()
userId = students_data['data']['list'][0]['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']
NetWork(server=self.server, resignClassIds=[class_id]).network_set()
order_id = SaveOrder(server=self.server, studentId=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()
time.sleep(2)
choose_data = ChooseClasses(server=self.server, studentId=userId, schoolAreaId=self.schoolArea).choose_class()
assert_data = ChangeListIndex().change_list_index(choose_data.get('data'), 'id', class_id)
with assume: assert choose_data['code'] == 0
with assume: assert assert_data.get('id') == class_id
with assume: assert assert_data.get('signUp') is True
......@@ -77,7 +77,7 @@ class TestAuthHaveClasses:
"discountId": "",
"category": "CLASS"
})
order_id = SaveOrder(server=self.server, studentId=self.userId, amount=700, details=self.details).save_order()['data']
order_id = SaveOrder(server=self.server, studentId=self.userId, amount=700, details=self.details).save_order().get('data')
PayOrder(server=self.server, orderId=order_id, payInfos=[
{
......@@ -96,7 +96,13 @@ class TestAuthHaveClasses:
with assume: assert query_data['msg'] == '成功'
with assume: assert query_data['data']['studentClassInfoDtoList'] != []
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 self.details[0]['classId'] in jsonpath.jsonpath(query_data, '$...classId')
with assume: assert self.details[1]['classId'] in jsonpath.jsonpath(query_data, '$...classId')
with assume: assert self.details[2]['classId'] in jsonpath.jsonpath(query_data, '$...classId')
with assume: assert self.details[3]['classId'] in jsonpath.jsonpath(query_data, '$...classId')
with assume: assert self.details[4]['classId'] in jsonpath.jsonpath(query_data, '$...classId')
with assume: assert self.details[5]['classId'] in jsonpath.jsonpath(query_data, '$...classId')
with assume: assert self.details[6]['classId'] in jsonpath.jsonpath(query_data, '$...classId')
@allure.story('学生有在读班级')
@allure.title('数学科目筛选')
......
......@@ -24,8 +24,8 @@ class TestAuthLogin:
@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['msg'] == '成功'
with assume: assert auth_data.get('code') == 0
with assume: assert auth_data.get('msg') == '成功'
@allure.story('登录验证')
@allure.title('用户名正确,密码不正确')
......@@ -33,8 +33,8 @@ class TestAuthLogin:
@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['msg'] == '用户名或密码错误!'
with assume: assert auth_data.get('code') != 0
with assume: assert auth_data.get('msg') == '用户名或密码错误!'
@allure.story('登录验证')
@allure.title('用户名错误,密码正确')
......@@ -42,8 +42,8 @@ class TestAuthLogin:
@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 '该手机号未注册' in auth_data['msg']
with assume: assert auth_data.get('code') != 0
with assume: assert '该手机号未注册' in auth_data.get('msg')
@allure.story('登录验证')
@allure.title('用户名密码为空')
......@@ -51,8 +51,8 @@ class TestAuthLogin:
@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 '该手机号未注册' in auth_data['msg']
with assume: assert auth_data.get('code') != 0
with assume: assert '该手机号未注册' in auth_data.get('msg')
@allure.story('登录验证')
@allure.title('用户名为中文,密码正确')
......@@ -60,5 +60,5 @@ class TestAuthLogin:
@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 '该手机号未注册' in auth_data['msg']
with assume: assert auth_data.get('code') != 0
with assume: assert '该手机号未注册' in auth_data.get('msg')
......@@ -19,9 +19,10 @@ class TestAuthStudents:
@allure.description('查询学生包含这个学生')
def test_students(self):
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.get('code') == 0
with assume: assert '小黄测试学生三年级' in jsonpath.jsonpath(students_data, '$..name')
with assume: assert students_data['data'][0]['student']['phones'][0] == '13364004418'
for students in jsonpath.jsonpath(students_data, '$...phones'):
with assume: assert students == ['13364004418']
@allure.story('登录成功验证')
@allure.title('查询学生设备绑定关系')
......@@ -33,5 +34,4 @@ class TestAuthStudents:
"clientIdentify": ""
}
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.get('code') == 0
import requests
from script.base_api import pay_post
from script.base_api.api_operation_web.pay import pay_post
from script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login import Headers
......@@ -35,7 +33,7 @@ class PayOrder:
"""
self.payInfos = payInfos
self.pay_url = '/api-operation-web/pay'
# self.pay_url = '/api-operation-web/pay'
self.pay_body = {
"orderId": self.orderId,
"operatorId": self.operatorId,
......
import requests
import datetime
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.xin_project_patriarch_app.xin_static.xin_crm.xin_student import CreateStudent
from script.xin_project_patriarch_app.xin_static.xin_service.xin_service import Service_get
......@@ -13,8 +13,8 @@ class PlaceOrder:
password=None,
studentId=None):
self.server = server
self.sava_order_url = '/api-operation-web/order/saveOrder?'
self.pay_url = '/api-operation-web/pay'
# self.sava_order_url = '/api-operation-web/order/saveOrder'
# self.pay_url = '/api-operation-web/pay'
self.username = username
self.password = password
self.studentId = studentId
......@@ -58,7 +58,7 @@ class PlaceOrder:
}
]
}
pay_data = requests.post(self.server + self.pay_url, json=pay_body, headers=self.header, verify=False)
pay_data = pay_post(body=pay_body, header=self.header)
return pay_data.json()
......
import requests
from script.base_api.api_operation_web import order_saveOrder_post
from script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login import Headers
......
......@@ -149,7 +149,7 @@ class CreateStudent:
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
json_data = clue_manualInputAdd_post(body=create_body, header=self.header, default_assert=False)
# json_data = requests.post(url=self.server + create_url, json=create_body, headers=self.header, verify=False)
if json_data['code'] == 0 and json_data['msg'] == '成功':
if json_data.get('code') == 0 and json_data.get('msg') == '成功':
return self.query_student()
else:
return json_data
......
import jsonpath
import requests
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
......@@ -105,7 +103,7 @@ class CreateClass:
class_data.pop('teacherId')
add_class_data = education_classes_add_post(params='recommit-ticket=temp-ticket', body=class_data, header=self.header, default_assert=False)
# add_class_data = requests.post(url=self.server + class_url, json=class_data, headers=self.header, verify=False)
if add_class_data['code'] == 0:
if add_class_data.get('code') == 0:
# query_url = '/service-education/education/classes/query'
query_data = {
"pageSize": 30,
......@@ -124,7 +122,7 @@ class CreateClass:
}
# query_class = requests.post(url=self.server + query_url, json=query_data, headers=self.header, verify=False)
query_class = education_classes_query_post(body=query_data, header=self.header, default_assert=False)
return query_class['data']['list'][0]
return query_class.get('data').get('list')[0]
else:
return add_class_data
......
import requests
from script.base_api import education_classes_delete_post
from script.xin_project_patriarch_app.xin_static.xin_user.xin_jky_pc_login import Headers
......@@ -19,7 +17,7 @@ class DeleteClass:
# self.url = '/service-education/education/classes/delete'
def delete_class(self):
delete_msg = education_classes_delete_post(body=self.classes,header=self.headers,default_assert=False)
delete_msg = education_classes_delete_post(body=self.classes, header=self.headers, default_assert=False)
return delete_msg
......
......@@ -124,7 +124,7 @@ class UpdateClass:
# 修改是否属于外地生班
def update_class_outLandClass(self, value: bool):
outLandClass_url = '/service-education/education/classes/optionalUpdate'
# outLandClass_url = '/service-education/education/classes/optionalUpdate'
fields = {
"fields": [
{
......
import datetime
import requests
from script.base_api import education_courses_add_post, education_courses_query_post, education_courses_delete_post
......@@ -36,7 +38,7 @@ class CreateCourse:
schools: list = None,
cContent=None,
):
self.courseName = courseName or "小黄测试课程"
self.courseName = courseName or "小黄"
self.term = term or "春"
self.subject = subject or "数学"
self.productType = productType or "主线课程"
......@@ -86,7 +88,7 @@ class CreateCourse:
# course_url = '/service-education/education/courses/add?recommit-ticket=temp-ticket'
course_body = [
{
"courseName": self.courseName + self.classType + self.courseType,
"courseName": self.courseName + self.classType + self.courseType + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
"term": self.term,
"subject": self.subject,
"productType": self.productType,
......
......@@ -2,10 +2,10 @@ import json
import allure
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
from script.xin_project_patriarch_app.xin_static.xin_yaml import ReadYaml, WriteYaml
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
......@@ -44,8 +44,8 @@ class AuthHeaders:
auth_yaml = ReadYaml.read_yaml_data(r'\xin_static\xin_user\patriarch_user')
try:
for auth_data in auth_yaml:
if auth_data['server'] == self.server and auth_data['user'] == self.username:
return auth_data['headers']
if auth_data.get('server') == self.server and auth_data.get('user') == self.username:
return auth_data.get('headers')
return self.add_auth_token(add=True)
except TypeError:
return self.add_auth_token()
......@@ -53,7 +53,7 @@ class AuthHeaders:
def add_auth_token(self, add=False):
auth_json = self.get_auth_token()
# print(auth_json)
token = "Bearer " + auth_json['data']['token']
token = "Bearer " + auth_json.get('data').get('token')
headers = {'Content-Type': 'application/json;charset=UTF-8',
'Authorization': token}
content = [
......@@ -61,7 +61,7 @@ class AuthHeaders:
'user': self.username,
'server': self.server,
'headers': headers,
'userId': auth_json['data']['userId']
'userId': auth_json.get('data').get('userId')
}
]
if add:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment