Commit e734a68a authored by huangqiang's avatar huangqiang

完成常规导出功能的自动化demo

parent 0df2a10a
...@@ -6,4 +6,5 @@ temp ...@@ -6,4 +6,5 @@ temp
*.xml *.xml
script/base_api script/base_api
test/ test/
__pycache__/ __pycache__/
\ No newline at end of file download_file_temp/
\ No newline at end of file
...@@ -2,19 +2,33 @@ ...@@ -2,19 +2,33 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="ceb24b37-65a1-4b3f-be3f-7040ebc4079d" name="默认变更列表" comment=""> <list default="true" id="ceb24b37-65a1-4b3f-be3f-7040ebc4079d" name="默认变更列表" comment="">
<change afterPath="$PROJECT_DIR$/script/base_api_data/__init__.py" afterDir="false" /> <change afterPath="$PROJECT_DIR$/script/base_api_data/service_crm/dict_data.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/base_api_data/service-education/__init__.py" afterDir="false" /> <change afterPath="$PROJECT_DIR$/script/base_api_data/service_education/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/base_api_data/service-education/system_data.py" afterDir="false" /> <change afterPath="$PROJECT_DIR$/script/base_api_data/service_education/education_data.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/base_api_data/service_statistics/__init__.py" afterDir="false" /> <change afterPath="$PROJECT_DIR$/script/download_flle/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/download_flle/assert_config/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/download_flle/assert_config/education_download_assert.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/download_flle/data_config/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/download_flle/data_config/suite_data.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/download_flle/jyy_download_file/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/download_flle/jyy_download_file/test_education_download.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/global_data_config/download_file.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/common/common_config.py" beforeDir="false" afterPath="$PROJECT_DIR$/common/common_config.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/common/run_method.py" beforeDir="false" afterPath="$PROJECT_DIR$/common/run_method.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/run.py" beforeDir="false" afterPath="$PROJECT_DIR$/run.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/run.py" beforeDir="false" afterPath="$PROJECT_DIR$/run.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/base_api_data/service-education/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/base_api_data/service_crm/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/base_api_data/service-education/system_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/base_api_data/service_education/system_data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/global_data_config/global_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/global_data_config/global_data.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/script/global_data_config/global_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/global_data_config/global_data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/assert_config/basic_parameter_set_assert.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/assert_config/basic_parameter_set_assert.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config/basic_parameter_set_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config/basic_parameter_set_data.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config/basic_parameter_set_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config/basic_parameter_set_data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config/global_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config/global_data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config/query_sql.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config/query_sql.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/test_basic_parameter_set.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/test_basic_parameter_set.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/test_basic_parameter_set.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/test_basic_parameter_set.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/public_asserts.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/public_asserts.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_add_class.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_add_class.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_delete_class.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_delete_class.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_update_class.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_update_class.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_course_handle/xin_course.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_course_handle/xin_course.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_course_handle/xin_update_course.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_course_handle/xin_update_course.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_network.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_network.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/tools/url_to_method.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools/url_to_method.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/tools/url_to_method.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools/url_to_method.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
...@@ -32,6 +46,14 @@ ...@@ -32,6 +46,14 @@
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
<component name="GitSEFilterConfiguration">
<file-type-list>
<filtered-out-file-type name="LOCAL_BRANCH" />
<filtered-out-file-type name="REMOTE_BRANCH" />
<filtered-out-file-type name="TAG" />
<filtered-out-file-type name="COMMIT_BY_MESSAGE" />
</file-type-list>
</component>
<component name="ProjectId" id="1spQZENnElyRDLJvVS2lDHEtBOX" /> <component name="ProjectId" id="1spQZENnElyRDLJvVS2lDHEtBOX" />
<component name="ProjectViewState"> <component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
...@@ -46,12 +68,13 @@ ...@@ -46,12 +68,13 @@
</component> </component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS"> <key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/script/global_data_config" />
<recent name="$PROJECT_DIR$/script/ding_ding_jdata/full_class_rate/assert_config" /> <recent name="$PROJECT_DIR$/script/ding_ding_jdata/full_class_rate/assert_config" />
<recent name="$PROJECT_DIR$/script/ding_ding_jdata/home_page" /> <recent name="$PROJECT_DIR$/script/ding_ding_jdata/home_page" />
</key> </key>
</component> </component>
<component name="RunManager" selected="Python.url_to_method"> <component name="RunManager" selected="Python.run">
<configuration name="basic_parameter_set_data" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> <configuration name="debug" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="jk_interface_test" /> <module name="jk_interface_test" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
...@@ -59,11 +82,11 @@ ...@@ -59,11 +82,11 @@
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
</envs> </envs>
<option name="SDK_HOME" value="" /> <option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test" />
<option name="IS_MODULE_SDK" value="true" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config/basic_parameter_set_data.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/test/debug.py" />
<option name="PARAMETERS" value="" /> <option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />
...@@ -72,7 +95,7 @@ ...@@ -72,7 +95,7 @@
<option name="INPUT_FILE" value="" /> <option name="INPUT_FILE" value="" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
<configuration name="global_data" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> <configuration name="download_file" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="jk_interface_test" /> <module name="jk_interface_test" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
...@@ -80,11 +103,11 @@ ...@@ -80,11 +103,11 @@
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
</envs> </envs>
<option name="SDK_HOME" value="" /> <option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/script/global_data_config" />
<option name="IS_MODULE_SDK" value="true" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config/global_data.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/script/global_data_config/download_file.py" />
<option name="PARAMETERS" value="" /> <option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />
...@@ -93,7 +116,7 @@ ...@@ -93,7 +116,7 @@
<option name="INPUT_FILE" value="" /> <option name="INPUT_FILE" value="" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
<configuration name="init_base_api" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> <configuration name="education_download_assert" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="jk_interface_test" /> <module name="jk_interface_test" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
...@@ -101,11 +124,11 @@ ...@@ -101,11 +124,11 @@
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
</envs> </envs>
<option name="SDK_HOME" value="" /> <option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/tools" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/script/download_flle/assert_config" />
<option name="IS_MODULE_SDK" value="true" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tools/init_base_api.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/script/download_flle/assert_config/education_download_assert.py" />
<option name="PARAMETERS" value="" /> <option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />
...@@ -158,11 +181,11 @@ ...@@ -158,11 +181,11 @@
</configuration> </configuration>
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="Python.url_to_method" />
<item itemvalue="Python.run" /> <item itemvalue="Python.run" />
<item itemvalue="Python.global_data" /> <item itemvalue="Python.education_download_assert" />
<item itemvalue="Python.basic_parameter_set_data" /> <item itemvalue="Python.debug" />
<item itemvalue="Python.init_base_api" /> <item itemvalue="Python.url_to_method" />
<item itemvalue="Python.download_file" />
</list> </list>
</recent_temporary> </recent_temporary>
</component> </component>
......
...@@ -79,9 +79,17 @@ class RunMethod: ...@@ -79,9 +79,17 @@ class RunMethod:
request_data = replace_string(request_data_template, request_data_dict) request_data = replace_string(request_data_template, request_data_dict)
allure.attach(body=request_data, name='请求信息信息', attachment_type=allure.attachment_type.TEXT) allure.attach(body=request_data, name='请求信息信息', attachment_type=allure.attachment_type.TEXT)
if return_json: if return_json:
allure.attach(body=json.dumps(res, ensure_ascii=False), name='响应信息', attachment_type=allure.attachment_type.JSON) attach_body = json.dumps(res, ensure_ascii=False)
if len(attach_body) > 65535:
allure.attach(body=attach_body[:65535], name='响应信息', attachment_type=allure.attachment_type.TEXT)
else:
allure.attach(body=attach_body, name='响应信息', attachment_type=allure.attachment_type.JSON)
else: else:
allure.attach(body=res.text, name='响应信息', attachment_type=allure.attachment_type.TEXT) attach_body = res.text
if len(attach_body) > 65535:
allure.attach(body=attach_body[:65535], name='响应信息', attachment_type=allure.attachment_type.TEXT)
else:
allure.attach(body=attach_body, name='响应信息', attachment_type=allure.attachment_type.TEXT)
return res return res
......
...@@ -62,12 +62,12 @@ class RunTest: ...@@ -62,12 +62,12 @@ class RunTest:
if __name__ == '__main__': if __name__ == '__main__':
case_path_list = [ case_path_list = [
"./script/ji_yun_ying_pc/system_set/test_basic_parameter_set.py::TestGradeOpenSubject::test_grade_subject_data_paging", "./script/download_flle/jyy_download_file/test_education_download.py",
# "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_date", # "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_date",
# "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_target", # "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_target",
# "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_subject", # "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_subject",
] ]
# host = "https://geek.jkwljy.com/" # host = "https://geek.jkwljy.com"
# account_group = "线上" # account_group = "线上"
host = "http://192.168.32.36" host = "http://192.168.32.36"
account_group = "A" account_group = "A"
...@@ -77,7 +77,8 @@ if __name__ == '__main__': ...@@ -77,7 +77,8 @@ if __name__ == '__main__':
# other_cmd = ['--reruns=1', '--reruns-delay=1'] # other_cmd = ['--reruns=1', '--reruns-delay=1']
other_cmd = [] other_cmd = []
run_obj = RunTest(case_path_list, host=host, account_group=account_group, db_config=db_config) run_obj = RunTest(case_path_list, host=host, account_group=account_group, db_config=db_config)
run_obj.run_test(other_cmd) x = run_obj.run_test(other_cmd)
print(x.value)
# run_obj.collection_case() # run_obj.collection_case()
run_obj.generate_allure_report() run_obj.generate_allure_report()
from script.base_api.service_crm.dict import dict_studentSource_query_post
from script.default_header import jyy_header
class QueryStudentSource:
def __init__(self, status=""):
self.status = status
def run(self, other_field: dict = {}, header=jyy_header, return_json=True, **kwargs):
body = {**self.__dict__, **other_field}
return dict_studentSource_query_post(body=body, header=header, return_json=return_json, **kwargs)
\ No newline at end of file
from script.base_api.service_education.education import education_classes_query_post
from script.global_data_config.global_data import GlobalDataConfig
from script.default_header import jyy_header
class QueryClassList:
def __init__(self, courseType="常规班课", pageNum=1, pageSize=10, schoolAreaIds=None):
self.courseType = courseType
self.pageNum = pageNum
self.pageSize = pageSize
self.schoolAreaIds = schoolAreaIds or GlobalDataConfig.get_department_id()
def run(self, other_field: dict = {}, header=jyy_header, return_json=True, **kwargs):
body = {**self.__dict__, **other_field}
return education_classes_query_post(body=body, header=header, return_json=return_json, **kwargs)
\ No newline at end of file
import allure
from pytest_assume.plugin import assume
import pandas as pd
import datacompy
class_field_map = {
"classAbbreviation": "班级简称",
"classBeginDate_export": "开班日期",
"classId": "班级ID",
"className": "班级名称",
"classStatus": "状态",
"classTeacher": "任课老师",
"classroom": "教室",
"courseId": "课程ID",
"directorName": "班主任老师",
"directorNumber": "班主任老师工号",
"employeeNumber": "老师工号",
"subject": "科目",
"targetNum": "满班目标",
"term": "学期",
"year": "年份"
}
class_file_field = ['班级简称', '开班日期', '班级ID', '班级名称', '状态', '任课老师', '教室', '课程ID',
'班主任老师', '班主任老师工号', '老师工号', '科目', '满班目标', '学期', '年份']
@allure.step("断言导出的excel的相同字段的数据一致")
def assert_class_download_data_equal_query(query_list, download_file_path):
download_df = pd.read_excel(download_file_path)
if query_list:
query_df = pd.DataFrame(query_list)
query_df.rename(columns=class_field_map, inplace=True)
query_df = query_df.loc[:, class_file_field]
query_df.fillna("-", inplace=True)
query_df = query_df.astype(str)
download_df = download_df.loc[:, class_file_field]
download_df = download_df.astype(str)
result = datacompy.Compare(download_df, query_df, on_index=True, df1_name="下载数据", df2_name="查询数据")
assert result.matches(), result.report()
else:
assert download_df.empty, f"无数据时数据应该为空,{download_df}"
@allure.step("断言导出的excel与列表查询的相同字段的数据一致")
def assert_class_download_data_equal_query(query_list, download_file_path):
download_df = pd.read_excel(download_file_path)
if query_list:
query_df = pd.DataFrame(query_list)
query_df.rename(columns=class_field_map, inplace=True)
query_df = query_df.loc[:, class_file_field]
query_df.fillna("-", inplace=True)
query_df = query_df.astype(str)
download_df = download_df.loc[:, class_file_field]
download_df = download_df.astype(str)
result = datacompy.Compare(download_df, query_df, on_index=True, df1_name="下载数据", df2_name="查询数据")
assert result.matches(), result.report()
else:
assert download_df.empty, f"无数据时数据应该为空,{download_df}"
from script.global_data_config.global_data import GlobalDataConfig
all_school_area_id = GlobalDataConfig.get_department_id(is_rm_test_school=True)
all_school_area_id_name_map = GlobalDataConfig.get_school_area_id_map()
import allure
from script.base_api.service_report.export import export_education_class_post
from script.global_data_config.download_file import download_file_by_file_id
from script.download_flle.data_config import suite_data
from script.base_api_data.service_education.education_data import QueryClassList
from script.download_flle.assert_config.education_download_assert import *
from script import public_asserts
from script.default_header import jyy_header
import os
@allure.feature("测试教务班级列表导出")
class TestClassDownload:
download_file_list = []
@allure.story("测试班级列表导出-2021暑-年份期段筛选")
def test_download_class_by_year_term(self):
year = 2023
term = "暑"
courseType = "常规班课"
schoolAreaIds = suite_data.all_school_area_id
schoolAreas = {k: v for k, v in suite_data.all_school_area_id_name_map.items() if k in schoolAreaIds}
body = {
"courseType": courseType,
"year": year, "term": term,
"schoolAreaIds": schoolAreaIds,
# 校区id与名称的映射字典字符串
"schoolAreas": str(schoolAreas),
}
res = export_education_class_post(body=body, header=jyy_header)
public_asserts.public_assert(res)
data = res.get("data")
assert data, f"响应的不为空,{data}"
result, file_path = download_file_by_file_id(file_id=data, file_dir="./download_file_temp/")
assert result, f"下载结果:{result}"
assert file_path, f"文件路径:{file_path}"
TestClassDownload.download_file_list.append(file_path)
qct = QueryClassList(courseType=courseType, pageSize=100000, schoolAreaIds=schoolAreaIds)
assert_res = qct.run(other_field={"year": year, "term": term})
assert_data = assert_res.get("data")
assert assert_data, "响应的数据不为空"
assert_list = assert_data.get("list")
# assert_class_download_data_equal_query(assert_list, file_path)
public_asserts.assert_download_data_equal_query(file_path, assert_list, download_field_map=class_field_map)
def teardown_class(self):
[os.remove(x) for x in TestClassDownload.download_file_list]
import time
import os
from urllib import request
import urllib
import ssl
from script.base_api.service_report.export import export_queryUrl_get
from script.default_header import jyy_header
ssl._create_default_https_context = ssl._create_unverified_context
def download_file(url, file_path):
request.urlretrieve(url, file_path)
def download_file_by_file_id(file_id, file_dir="./download_file_temp/", header=jyy_header):
params = {"id": file_id}
try:
poll_time = 1
is_download = False
file_path = ""
while not is_download and poll_time <= 12:
time.sleep(5)
res = export_queryUrl_get(params=params, header=header)
file_url = res.get("data")
if file_url:
file_name = file_url.rsplit("/")[-1]
file_name = urllib.parse.unquote(file_name)
file_path = os.path.join(file_dir, file_name)
request.urlretrieve(file_url, file_path)
is_download = True
else:
print(f"第{poll_time}轮询完成,file_url:{file_url}")
poll_time += 1
return is_download, file_path
except Exception as e:
return False, file_path
...@@ -74,8 +74,14 @@ class GlobalDataConfig: ...@@ -74,8 +74,14 @@ class GlobalDataConfig:
all_class_type = [*all_class_type, *v] all_class_type = [*all_class_type, *v]
return all_class_type return all_class_type
# 获取部门ID列表
@classmethod @classmethod
def get_department_id(cls, department_type=30, is_rm_test_school=False): def get_department_id(cls, department_type=30, is_rm_test_school=False) -> list:
"""
:department_type:部门类型
:is_rm_test_school:是否剔除测试校区默认否
:return:id列表
"""
sql = f"""select id from service_user.department where type = {department_type}""" sql = f"""select id from service_user.department where type = {department_type}"""
school_area_datas = OperationDb.query_sql(sql) school_area_datas = OperationDb.query_sql(sql)
school_area_ids = [x[0] for x in school_area_datas] school_area_ids = [x[0] for x in school_area_datas]
...@@ -84,6 +90,7 @@ class GlobalDataConfig: ...@@ -84,6 +90,7 @@ class GlobalDataConfig:
else: else:
return school_area_ids return school_area_ids
# 通过区域id获取对应校区ID列表
@staticmethod @staticmethod
def get_school_id_by_area_id(area_id): def get_school_id_by_area_id(area_id):
sql = f"""select id from service_user.department where type = 30 and parent_id = {area_id}""" sql = f"""select id from service_user.department where type = 30 and parent_id = {area_id}"""
...@@ -91,6 +98,7 @@ class GlobalDataConfig: ...@@ -91,6 +98,7 @@ class GlobalDataConfig:
school_area_ids = [x[0] for x in school_area_datas] school_area_ids = [x[0] for x in school_area_datas]
return school_area_ids return school_area_ids
# 通过大区id获取对应校区ID列表
@staticmethod @staticmethod
def get_school_id_by_big_area_id(big_area_id): def get_school_id_by_big_area_id(big_area_id):
sql = f"""select id from service_user.department sql = f"""select id from service_user.department
...@@ -99,6 +107,7 @@ class GlobalDataConfig: ...@@ -99,6 +107,7 @@ class GlobalDataConfig:
school_area_ids = [x[0] for x in school_area_datas] school_area_ids = [x[0] for x in school_area_datas]
return school_area_ids return school_area_ids
# 通过大区id获取对应区域ID列表
@staticmethod @staticmethod
def get_area_id_by_big_area_id(big_area_id): def get_area_id_by_big_area_id(big_area_id):
sql = f"""select id from service_user.department where type = 40 and parent_id = {big_area_id}""" sql = f"""select id from service_user.department where type = 40 and parent_id = {big_area_id}"""
...@@ -108,11 +117,12 @@ class GlobalDataConfig: ...@@ -108,11 +117,12 @@ class GlobalDataConfig:
# 校区id和名称映射(40为区域名称映射) # 校区id和名称映射(40为区域名称映射)
@staticmethod @staticmethod
def get_school_area_id_map(department_type=30): def get_school_area_id_map(department_type=30) -> dict:
sql = f"""select id,name from service_user.department where type = {department_type}""" sql = f"""select id,name from service_user.department where type = {department_type}"""
school_area_datas = OperationDb.query_sql(sql) school_area_datas = OperationDb.query_sql(sql)
return {x[0]: x[1] for x in school_area_datas} return {x[0]: x[1] for x in school_area_datas}
# 部门id和短名称映射(40为区域名称映射)
@staticmethod @staticmethod
def get_department_short_name_map(department_type=30): def get_department_short_name_map(department_type=30):
sql = f"""select id,short_name from service_user.department where type = {department_type}""" sql = f"""select id,short_name from service_user.department where type = {department_type}"""
......
import random
from script.ji_yun_ying_pc.system_set.data_config import global_data from script.ji_yun_ying_pc.system_set.data_config import global_data
from script.global_data_config.global_data import GlobalDataConfig from script.global_data_config.global_data import GlobalDataConfig
from common.connect_db import OperationDb
school_names = ["金沙", "德阳", "乐山春华广场中心校"] school_names = ["金沙", "德阳", "乐山春华广场中心校"]
err_school_names = ["!@#$%^", "'", "ada"] err_school_names = ["!@#$%^", "'", "ada"]
...@@ -116,6 +118,7 @@ def get_grade_open_subject(year, term): ...@@ -116,6 +118,7 @@ def get_grade_open_subject(year, term):
return open_subject_list return open_subject_list
# 获取可续报年级
def get_can_continue_grade(year, term): def get_can_continue_grade(year, term):
current_open_grade_list = get_open_grade(year, term) current_open_grade_list = get_open_grade(year, term)
next_year, next_term = get_next_year_term(year, term) next_year, next_term = get_next_year_term(year, term)
...@@ -135,3 +138,44 @@ def get_can_continue_grade(year, term): ...@@ -135,3 +138,44 @@ def get_can_continue_grade(year, term):
current_open_grade["can_continue_grade"] = can_continue_grade current_open_grade["can_continue_grade"] = can_continue_grade
return current_open_grade_list return current_open_grade_list
# 获取新增退费原因数据
def get_add_refund_reason_data():
return [
{
"message": "自动测试新增退费原因" + str(random.randint(10000, 99999)),
"description": 1,
},
{
"message": "自动测试新增退费原因" + str(random.randint(10000, 99999)),
"description": 2,
},
]
# 删除新增的退费原因
def delete_refund_reason(refund_reason_id):
sql = f"delete from public.system_setting where type = 'refundReason' and code_id = {refund_reason_id}"
OperationDb.insert_update_delete_sql(sql)
# 获取新增线索来源数据
def get_add_crm_source_data():
return [
{
"name": "自动测试新增线索来源" + str(random.randint(10000, 99999)),
"level_type": 20,
"parentId": 101
},
{
"name": "自动测试新增退费原因" + str(random.randint(10000, 99999)),
"level_type": 30,
"parentId": 111
},
]
# 删除新增的线索来源
def delete_crm_source(crm_source_id):
sql = f"delete from service_crm.student_source_dict where id = {crm_source_id}"
OperationDb.insert_update_delete_sql(sql)
import pytest import pytest
from script.ji_yun_ying_pc.system_set.data_config import basic_parameter_set_data
from script.base_api.service_education.system import system_setting_querySystemSettings_post from script.base_api.service_education.system import system_setting_querySystemSettings_post
from script.ji_yun_ying_pc.system_set.assert_config.basic_parameter_set_assert import * from script.ji_yun_ying_pc.system_set.assert_config.basic_parameter_set_assert import *
from script.base_api.service_statistics.school import school_type_school_post from script.base_api.service_statistics.school import school_type_school_post
...@@ -7,18 +6,85 @@ from script.base_api.service_statistics.school import school_type_area_post ...@@ -7,18 +6,85 @@ from script.base_api.service_statistics.school import school_type_area_post
from script.base_api.service_statistics.statistics import statistics_setting_queryGradeSubjects_get from script.base_api.service_statistics.statistics import statistics_setting_queryGradeSubjects_get
from script.base_api.service_statistics.statistics import statistics_setting_querySubjectGrades_get from script.base_api.service_statistics.statistics import statistics_setting_querySubjectGrades_get
from script.base_api.service_education.system import system_setting_addSettingByParam_post from script.base_api.service_education.system import system_setting_addSettingByParam_post
from script.base_api.service_education.system import system_setting_editSettingByParam_post
from script.base_api.service_education.system import system_setting_query_get
from script.base_api.service_crm.dict import dict_studentSource_add_post
from script.global_data_config.global_data import GlobalDataConfig from script.global_data_config.global_data import GlobalDataConfig
from script.base_api_data.service_education.system_data import QuerySystemSetting
from script.base_api_data.service_crm.dict_data import QueryStudentSource
from script import public_asserts from script import public_asserts
from script.default_header import jyy_header from script.default_header import jyy_header
import jsonpath
@allure.epic("测试基础参数设置") @allure.epic("测试基础参数设置")
@allure.feature("测试线索来源设置") @allure.feature("测试线索来源设置")
class TestCrmSourceSet: class TestCrmSourceSet:
add_crm_source = []
@allure.story("测试新增线索来源") @allure.story("测试新增线索来源")
def test_new_crm_source(self): @pytest.mark.parametrize("crm_source_data", basic_parameter_set_data.get_add_crm_source_data())
pass def test_new_crm_source(self, crm_source_data):
name = crm_source_data.get("name")
level_type = crm_source_data.get("level_type")
parentId = crm_source_data.get("parentId")
body = {"name": name, "type": level_type, "parentId": parentId}
res = dict_studentSource_add_post(body=body, header=jyy_header)
public_asserts.public_assert(res)
assert_res = QueryStudentSource().run()
assert_res_data = jsonpath.jsonpath(assert_res, f"$..children")
assert assert_res_data, f"查询的学生来源数据不为空, {assert_res_data}"
assert_res_data_new = []
for x in assert_res_data:
if x:
assert_res_data_new.extend(x)
is_have_data = [x for x in assert_res_data_new if x.get("name") == name
and x.get("type") == level_type
and x.get("parentId") == parentId
and x.get("status") == 1]
assert is_have_data, f"查询列表有刚新增的数据{is_have_data}"
assert len(is_have_data) == 1, f"新增的数据应该只有1条,{len(is_have_data)}"
TestCrmSourceSet.add_crm_source.extend(is_have_data)
@allure.story("测试新增线索来源-名称为空时新增失败")
def test_new_crm_source_null(self):
body = {"name": "", "type": 20, "parentId": 101}
res = dict_studentSource_add_post(body=body, header=jyy_header)
code = res.get("code")
assert code == 100110001, f"名称为空时新增失败,{res.get('code')}"
@allure.story("测试新增线索来源-已经存在的的线索来源不能新增")
def test_new_crm_source_have_data(self):
add_res = QueryStudentSource().run()
add_res_data_list = jsonpath.jsonpath(add_res, f"$..children")
add_res_data_list_new = []
for x in add_res_data_list:
if x:
add_res_data_list_new.extend(x)
add_res_data_list = [x for x in add_res_data_list_new if x.get("status") == 1]
add_res_data = add_res_data_list[0]
name = add_res_data.get("name")
level_type = add_res_data.get("type")
parentId = add_res_data.get("parentId")
body = {"name": name, "type": level_type, "parentId": parentId}
res = dict_studentSource_add_post(body=body, header=jyy_header)
assert res.get("code") == 100210001
assert res.get("msg") == "该来源名称已存在"
assert_res = QueryStudentSource().run()
assert_res_data = jsonpath.jsonpath(assert_res, f"$..children")
assert assert_res_data, f"查询的学生来源数据不为空, {assert_res_data}"
assert_res_data_new = []
for x in assert_res_data:
if x:
assert_res_data_new.extend(x)
is_have_data = [x for x in assert_res_data_new if x.get("name") == name
and x.get("type") == level_type
and x.get("parentId") == parentId
and x.get("status") == 1]
assert len(is_have_data) == 1, f"新增的失败后数据应该只有1条,{len(is_have_data)}"
@allure.story("测试编辑线索来源") @allure.story("测试编辑线索来源")
def test_edit_crm_source(self): def test_edit_crm_source(self):
...@@ -32,40 +98,72 @@ class TestCrmSourceSet: ...@@ -32,40 +98,72 @@ class TestCrmSourceSet:
def test_stop_and_crm_source(self): def test_stop_and_crm_source(self):
pass pass
def teardown_class(self):
[basic_parameter_set_data.delete_crm_source(x.get("id")) for x in TestCrmSourceSet.add_crm_source]
@allure.epic("测试基础参数设置") @allure.epic("测试基础参数设置")
@allure.feature("测试退费原因设置") @allure.feature("测试退费原因设置")
class TestRefundReasonSet: class TestRefundReasonSet:
add_refund_reason = []
@allure.story("测试新增退费原因") @allure.story("测试新增退费原因")
def test_new_refund_reason(self): @pytest.mark.parametrize("refund_reason_data", basic_parameter_set_data.get_add_refund_reason_data())
def test_new_refund_reason(self, refund_reason_data):
message = refund_reason_data.get("message")
description = refund_reason_data.get("description")
status = 1
body = { body = {
"type": "refundReason", "type": "refundReason",
"message": "kkk", "message": message,
"description": 1, "description": description,
"status": 1 "status": status
} }
res = system_setting_addSettingByParam_post(body=body, header=jyy_header) res = system_setting_addSettingByParam_post(body=body, header=jyy_header)
public_asserts.public_assert(res) public_asserts.public_assert(res)
assert_res = system_setting_querySystemSettings_post(body={"types":["refundReason"]}, header=jyy_header) assert_res = QuerySystemSetting().run()
assert_res_data = assert_res.get("data") assert_res_data = assert_res.get("data")
assert assert_res_data, f"返回的退费原因数据列不会为空,{assert_res_data}"
is_have_data = [x for x in assert_res_data if x.get("message") == message
and x.get("description") == str(description)
and x.get("status") == status]
assert is_have_data, f"查询列表有刚新增的数据{is_have_data}"
assert len(is_have_data) == 1, f"新增的数据应该只有1条,{len(is_have_data)}"
TestRefundReasonSet.add_refund_reason.extend(is_have_data)
@allure.story("测试编辑退费原因") @allure.story("测试编辑退费原因")
def test_edit_refund_reason(self): @pytest.mark.parametrize("description", [1, 2, 1])
pass def test_edit_refund_reason(self, description):
codeId = 91134
@allure.story("测试查询退费原因") body = {"codeId": codeId, "description": description}
def test_search_refund_reason(self): res = system_setting_editSettingByParam_post(body=body, header=jyy_header)
pass public_asserts.public_assert(res)
assert_res = QuerySystemSetting().run()
assert_res_data = assert_res.get("data")
assert assert_res_data, f"返回的退费原因数据列不会为空,{assert_res_data}"
is_have_data = [x for x in assert_res_data if x.get("codeId") == codeId
and x.get("description") == str(description)]
assert is_have_data, f"查询列表有刚编辑后的数据{is_have_data}"
assert len(is_have_data) == 1, f"编辑后的数据只有1条,{len(is_have_data)}"
@allure.story("测试停用启用退费原因") @allure.story("测试停用启用退费原因")
def test_stop_and_start_reason(self): @pytest.mark.parametrize("status", [1, 2, 1])
pass def test_stop_and_start_reason(self, status):
codeId = 91134
body = {"codeId": codeId, "status": status}
res = system_setting_editSettingByParam_post(body=body, header=jyy_header)
public_asserts.public_assert(res)
assert_res = QuerySystemSetting().run()
assert_res_data = assert_res.get("data")
assert assert_res_data, f"返回的退费原因数据列不会为空,{assert_res_data}"
is_have_data = [x for x in assert_res_data if x.get("codeId") == codeId
and x.get("status") == status]
assert is_have_data, f"查询列表有刚停用或启用后的数据{is_have_data}"
assert len(is_have_data) == 1, f"停用或启用后的数据只有1条,{len(is_have_data)}"
@allure.story("测试退费原因列表分页") def teardown_class(self):
def test_refund_reason_paging(self): [basic_parameter_set_data.delete_refund_reason(x.get("codeId")) for x in TestRefundReasonSet.add_refund_reason]
pass
@allure.epic("测试基础参数设置") @allure.epic("测试基础参数设置")
...@@ -73,8 +171,12 @@ class TestRefundReasonSet: ...@@ -73,8 +171,12 @@ class TestRefundReasonSet:
class TestApplyTypeSet: class TestApplyTypeSet:
@allure.story("测试查询报名类型") @allure.story("测试查询报名类型")
def test_search_apply_type(self): @pytest.mark.parametrize("data_type", ["studentType", "studentSources"])
pass def test_search_apply_type(self, data_type):
res = system_setting_query_get(params=f"type={data_type}", header=jyy_header)
public_asserts.public_assert(res)
data = res.get("data")
assert data, f"data不能为空,{data}"
@allure.epic("测试基础参数设置") @allure.epic("测试基础参数设置")
...@@ -117,7 +219,7 @@ class TestMaxClassTypeSet: ...@@ -117,7 +219,7 @@ class TestMaxClassTypeSet:
@allure.epic("测试基础参数设置") @allure.epic("测试基础参数设置")
@allure.feature("测试最高班型设置") @allure.feature("测试满班目标设置")
class TestFullClassTargetSet: class TestFullClassTargetSet:
@allure.story("测试大区筛选") @allure.story("测试大区筛选")
...@@ -136,11 +238,11 @@ class TestFullClassTargetSet: ...@@ -136,11 +238,11 @@ class TestFullClassTargetSet:
def test_paging_search(self): def test_paging_search(self):
pass pass
@allure.story("测试满班目标设置") @allure.story("测试新增满班目标设置")
def test_new_full_class_target(self): def test_new_full_class_target(self):
pass pass
@allure.story("测试满班目标设置") @allure.story("测试编辑满班目标设置")
def test_edit_full_class_target(self): def test_edit_full_class_target(self):
pass pass
......
...@@ -136,3 +136,40 @@ def assert_two_list_is_intersection(res_list: list, search_list: list): ...@@ -136,3 +136,40 @@ def assert_two_list_is_intersection(res_list: list, search_list: list):
flag = False flag = False
return flag return flag
@allure.step("断言导出的excel与列表查询的相同字段的数据一致")
def assert_download_data_equal_query(download_file_path, query_list, download_field_map: dict,
fillna_values="-", df1_name="下载数据", df2_name="查询数据",
join_columns=None, on_index=True,
ignore_spaces=False, ignore_case=False, cast_column_names_lower=True
):
"""
download_file_path: 下载文件路径
query_list: 查询的数据列表
join_columns : 对比时连接的列(单个为字符串, 多个传入列表),排序不一样时使用
on_index : 当join_columns为none时设置为true,排序一样时使用
df1_name : 对比后的名称
df2_name : 对比后的名称
ignore_spaces : 是否忽略空格
ignore_case : 是否忽略大小写
cast_column_names_lower: 列表转小写
"""
download_df = pd.read_excel(download_file_path)
if query_list:
query_df = pd.DataFrame(query_list)
query_df.rename(columns=download_field_map, inplace=True)
file_field = list(download_field_map.values())
query_df = query_df.loc[:, file_field]
query_df.fillna(fillna_values, inplace=True)
query_df = query_df.astype(str)
download_df = download_df.loc[:, file_field]
download_df = download_df.astype(str)
result = datacompy.Compare(download_df, query_df, join_columns=join_columns,
on_index=on_index, df1_name=df1_name, df2_name=df2_name,
ignore_spaces=ignore_spaces, ignore_case=ignore_case, cast_column_names_lower=cast_column_names_lower
)
assert result.matches(), result.report()
else:
assert download_df.empty, f"无数据时数据应该为空,{download_df}"
...@@ -48,9 +48,9 @@ class CreateClass: ...@@ -48,9 +48,9 @@ class CreateClass:
self.header = Headers(server=self.server, username=self.username, password=self.password).get_headers() self.header = Headers(server=self.server, username=self.username, password=self.password).get_headers()
def create_class(self): def create_class(self):
# class_url = '/service-education/education/classes/add?recommit-ticket=temp-ticket' # class_url = '/service_education/education/classes/add?recommit-ticket=temp-ticket'
# course_url = '/service-education/education/courses/query?pageNum=1&pageSize=10' # course_url = '/service_education/education/courses/query?pageNum=1&pageSize=10'
course_data = { course_data = {
"courseName": self.courseId, "courseName": self.courseId,
"type": "click", "type": "click",
...@@ -106,7 +106,7 @@ class CreateClass: ...@@ -106,7 +106,7 @@ class CreateClass:
add_class_data = education_classes_add_post(params='recommit-ticket=temp-ticket', body=class_data, header=self.header, default_assert=False) 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) # 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['code'] == 0:
# query_url = '/service-education/education/classes/query' # query_url = '/service_education/education/classes/query'
query_data = { query_data = {
"pageSize": 30, "pageSize": 30,
"pageNum": 1, "pageNum": 1,
......
...@@ -16,7 +16,7 @@ class DeleteClass: ...@@ -16,7 +16,7 @@ class DeleteClass:
self.classes = classes self.classes = classes
self.headers = Headers(server=self.server, username=username, password=password).get_headers() self.headers = Headers(server=self.server, username=username, password=password).get_headers()
# self.url = '/service-education/education/classes/delete' # self.url = '/service_education/education/classes/delete'
def delete_class(self): 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)
......
...@@ -17,7 +17,7 @@ class UpdateClass: ...@@ -17,7 +17,7 @@ class UpdateClass:
self.body = { self.body = {
"classId": self.classId "classId": self.classId
} }
# self.update_url = '/service-education/education/classes/optionalUpdate' # self.update_url = '/service_education/education/classes/optionalUpdate'
self.headers = Headers(server=self.server, username=username, password=password).get_headers() self.headers = Headers(server=self.server, username=username, password=password).get_headers()
...@@ -92,7 +92,7 @@ class UpdateClass: ...@@ -92,7 +92,7 @@ class UpdateClass:
# 修改预招收人数 # 修改预招收人数
def update_class_studentNum(self, value): def update_class_studentNum(self, value):
# studentNum_url = '/service-education/education/classes/update/limit' # studentNum_url = '/service_education/education/classes/update/limit'
fields = { fields = {
'fields': [ 'fields': [
{ {
...@@ -104,7 +104,7 @@ class UpdateClass: ...@@ -104,7 +104,7 @@ class UpdateClass:
# 修改满班目标 # 修改满班目标
def update_class_targetNum(self, value): def update_class_targetNum(self, value):
# targetNum_url = '/service-education/education/classes/update/targetNum' # targetNum_url = '/service_education/education/classes/update/targetNum'
fields = { fields = {
'fields': [ 'fields': [
{ {
...@@ -116,7 +116,7 @@ class UpdateClass: ...@@ -116,7 +116,7 @@ class UpdateClass:
# 修改班主任 # 修改班主任
def update_class_employee(self, value): def update_class_employee(self, value):
# employee_url = '/service-education/classDirector/update' # employee_url = '/service_education/classDirector/update'
fields = { fields = {
"employeeId": value "employeeId": value
} }
...@@ -124,7 +124,7 @@ class UpdateClass: ...@@ -124,7 +124,7 @@ class UpdateClass:
# 修改是否属于外地生班 # 修改是否属于外地生班
def update_class_outLandClass(self, value: bool): def update_class_outLandClass(self, value: bool):
outLandClass_url = '/service-education/education/classes/optionalUpdate' outLandClass_url = '/service_education/education/classes/optionalUpdate'
fields = { fields = {
"fields": [ "fields": [
{ {
...@@ -155,7 +155,7 @@ class UpdateClass: ...@@ -155,7 +155,7 @@ class UpdateClass:
} }
] ]
""" """
# schedule_url = '/service-education/education/classes/update' # schedule_url = '/service_education/education/classes/update'
data = { data = {
"classSchedule": classSchedule "classSchedule": classSchedule
} }
......
...@@ -83,7 +83,7 @@ class CreateCourse: ...@@ -83,7 +83,7 @@ class CreateCourse:
""" """
def create_course(self): def create_course(self):
# course_url = '/service-education/education/courses/add?recommit-ticket=temp-ticket' # course_url = '/service_education/education/courses/add?recommit-ticket=temp-ticket'
course_body = [ course_body = [
{ {
"courseName": self.courseName + self.classType + self.courseType, "courseName": self.courseName + self.classType + self.courseType,
...@@ -122,7 +122,7 @@ class CreateCourse: ...@@ -122,7 +122,7 @@ class CreateCourse:
course_body[0]['downhalfCoursePeriod'] = self.downhalfCoursePeriod course_body[0]['downhalfCoursePeriod'] = self.downhalfCoursePeriod
course_data = education_courses_add_post(body=course_body, header=self.header, default_assert=False) course_data = education_courses_add_post(body=course_body, header=self.header, default_assert=False)
if course_data['code'] == 0 and course_data['msg'] == '成功': if course_data['code'] == 0 and course_data['msg'] == '成功':
# query_url = '/service-education/education/courses/query?pageNum=1&pageSize=10' # query_url = '/service_education/education/courses/query?pageNum=1&pageSize=10'
schoolAreas = list() schoolAreas = list()
if self.schools is None: if self.schools is None:
schoolAreas.append(3052) schoolAreas.append(3052)
......
...@@ -10,7 +10,7 @@ def query_course(courseId, headers): ...@@ -10,7 +10,7 @@ def query_course(courseId, headers):
:param courseId: 课程ID :param courseId: 课程ID
:return: :return:
""" """
# query_url = '/service-education/education/courses/queryById' # query_url = '/service_education/education/courses/queryById'
query_data = { query_data = {
"courseId": courseId, "courseId": courseId,
"judgeUsed": True, "judgeUsed": True,
...@@ -72,7 +72,7 @@ class UpdateCourse: ...@@ -72,7 +72,7 @@ class UpdateCourse:
self.uphalfCoursePeriod = uphalfCoursePeriod self.uphalfCoursePeriod = uphalfCoursePeriod
self.downhalfCoursePeriod = downhalfCoursePeriod self.downhalfCoursePeriod = downhalfCoursePeriod
self.update_url = '/service-education/education/update/course/class' self.update_url = '/service_education/education/update/course/class'
self.headers = Headers(server=self.server, username=username, password=password).get_headers() self.headers = Headers(server=self.server, username=username, password=password).get_headers()
...@@ -127,7 +127,7 @@ class UpdateCoursePrice: ...@@ -127,7 +127,7 @@ class UpdateCoursePrice:
self.headers = Headers(server=self.server, username=self.username, password=self.password).get_headers() self.headers = Headers(server=self.server, username=self.username, password=self.password).get_headers()
# self.update_price_url = '/service-education/education/courses/modifyPrice' # self.update_price_url = '/service_education/education/courses/modifyPrice'
def update_course_price(self): def update_course_price(self):
course_data = query_course(courseId=self.courseId, headers=self.headers) course_data = query_course(courseId=self.courseId, headers=self.headers)
...@@ -170,7 +170,7 @@ class UpdateCourseSchool: ...@@ -170,7 +170,7 @@ class UpdateCourseSchool:
self.username = username self.username = username
self.password = password self.password = password
self.headers = Headers(server=self.server, username=self.username, password=self.password).get_headers() self.headers = Headers(server=self.server, username=self.username, password=self.password).get_headers()
self.update_school_url = '/service-education/education/courses/courseArea' self.update_school_url = '/service_education/education/courses/courseArea'
self.update_body = { self.update_body = {
"courseId": self.courseId, "courseId": self.courseId,
"schools": self.schools "schools": self.schools
......
...@@ -54,7 +54,7 @@ class NetWork: ...@@ -54,7 +54,7 @@ class NetWork:
"classSignEndDate": self.classSignEndDate, "classSignEndDate": self.classSignEndDate,
"classResignBeginDate": self.classResignBeginDate, "classResignBeginDate": self.classResignBeginDate,
"classResignEndDate": self.classResignEndDate} "classResignEndDate": self.classResignEndDate}
# network_url = '/service-education/education/classes/update/resignClassInfo' # network_url = '/service_education/education/classes/update/resignClassInfo'
network_data = education_classes_update_resignClassInfo_post(body=data, header=self.headers, default_assert=False) network_data = education_classes_update_resignClassInfo_post(body=data, header=self.headers, default_assert=False)
return network_data return network_data
......
...@@ -30,4 +30,4 @@ def get_method(url, method): ...@@ -30,4 +30,4 @@ def get_method(url, method):
if __name__ == '__main__': if __name__ == '__main__':
get_method("/service-education/system/setting/querySystemSettings", "post") get_method("/service-education/education/classes/query", "post")
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