Commit cc3093ad authored by 小刘's avatar 小刘

修改前置提示

parent 327cb1d6
import allure
import pytest
import jsonpath
from script import default_header
......@@ -18,15 +19,17 @@ def pytest_addoption(parser):
parser.addoption("--account", default="A", dest="account", help="set run default account group")
@allure.title('测试环境变量前置')
@pytest.fixture(scope='session', autouse=True)
def get_host(pytestconfig):
# 初始化测试环境变量
common_config["host"] = pytestconfig.getoption('--host')
allure.attach(body=common_config["host"], name='测试环境', attachment_type=allure.attachment_type.TEXT)
# 初始化测试数据库配置
common_config["db_config"] = db_configs.get(pytestconfig.getoption('--db'))
@allure.title('极运营登录前置')
@pytest.fixture(scope="session", autouse=True)
def ji_yun_ying_login(pytestconfig):
account = accounts.get(pytestconfig.getoption('--account').upper())
......@@ -47,6 +50,7 @@ def ji_yun_ying_login(pytestconfig):
default_header.jyy_header.setdefault("Authorization", "token not found")
@allure.title('小程序登录前置')
@pytest.fixture(scope="session", autouse=True)
def gos_login(pytestconfig):
account = accounts.get(pytestconfig.getoption('--account').upper())
......
......@@ -42,8 +42,8 @@ class TestChooseClasses:
productType='副线课程',
year=StaticGlobal.YEAR,
term=StaticGlobal.TERM).create_course()['data']['content'][0]['courseId']
class_id = CreateClass(server=self.server, courseId=course_id, schoolArea=self.schoolArea).create_class()['classId']
NetWork(server=self.server, resignClassIds=[class_id]).network_set()
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()
# 断言校区
@allure.story('选课中心-校区')
......@@ -268,3 +268,37 @@ class TestChooseClasses:
}
]).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 class_id not in jsonpath.jsonpath(choose_data, '$..id')
@allure.story('选课列表-班级')
@allure.title('购买了副线班,看不到常规班')
@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()
userId = students_data['data']['list'][0]['studentId']
order_id = SaveOrder(server=self.server, studentId=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(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')
@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
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