提交 a3afe59e896cf7730e01f3b7b8185ea22df1d5e8

作者 Shishutong
1 个父辈 9ca3ae6c

版本:1.0.9

1.新增查看全部实习接口
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <project version="4">
3 3 <component name="ChangeListManager">
4   - <list default="true" id="129454fc-5415-4c7e-9855-d0293355ede5" name="Default Changelist" comment="版本:1.0.8&#10;1.新增发布实习计划用例&#10;2.新增实习项目用例">
  4 + <list default="true" id="129454fc-5415-4c7e-9855-d0293355ede5" name="Default Changelist" comment="版本:1.0.9&#10;1.新增发布项目用例">
  5 + <change afterPath="$PROJECT_DIR$/data/student_practice/test_06__practice.xlsx" afterDir="false" />
  6 + <change afterPath="$PROJECT_DIR$/testcase/test_05_student_practice.py" afterDir="false" />
5 7 <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
  8 + <change beforePath="$PROJECT_DIR$/common/handle_path.py" beforeDir="false" afterPath="$PROJECT_DIR$/common/handle_path.py" afterDir="false" />
6 9 <change beforePath="$PROJECT_DIR$/conf/config.ini" beforeDir="false" afterPath="$PROJECT_DIR$/conf/config.ini" afterDir="false" />
7   - <change beforePath="$PROJECT_DIR$/data/Internship_preparation/test_04_internship_plan.xlsx" beforeDir="false" afterPath="$PROJECT_DIR$/data/Internship_preparation/test_04_internship_plan.xlsx" afterDir="false" />
8 10 <change beforePath="$PROJECT_DIR$/data/Internship_preparation/test_05_internship_project.xlsx" beforeDir="false" afterPath="$PROJECT_DIR$/data/Internship_preparation/test_05_internship_project.xlsx" afterDir="false" />
9   - <change beforePath="$PROJECT_DIR$/data/system/test_02_department.xlsx" beforeDir="false" afterPath="$PROJECT_DIR$/data/system/test_02_department.xlsx" afterDir="false" />
10   - <change beforePath="$PROJECT_DIR$/data/system/test_02_specialty.xlsx" beforeDir="false" afterPath="$PROJECT_DIR$/data/system/test_02_specialty.xlsx" afterDir="false" />
11   - <change beforePath="$PROJECT_DIR$/data/system/test_02_term.xlsx" beforeDir="false" afterPath="$PROJECT_DIR$/data/system/test_02_term.xlsx" afterDir="false" />
12   - <change beforePath="$PROJECT_DIR$/data/teaching_affairs/test_03_class.xlsx" beforeDir="false" afterPath="$PROJECT_DIR$/data/teaching_affairs/test_03_class.xlsx" afterDir="false" />
13   - <change beforePath="$PROJECT_DIR$/data/teaching_affairs/test_03_course.xlsx" beforeDir="false" afterPath="$PROJECT_DIR$/data/teaching_affairs/test_03_course.xlsx" afterDir="false" />
14   - <change beforePath="$PROJECT_DIR$/data/teaching_affairs/test_03_student.xlsx" beforeDir="false" afterPath="$PROJECT_DIR$/data/teaching_affairs/test_03_student.xlsx" afterDir="false" />
15   - <change beforePath="$PROJECT_DIR$/data/teaching_affairs/test_03_teacher.xlsx" beforeDir="false" afterPath="$PROJECT_DIR$/data/teaching_affairs/test_03_teacher.xlsx" afterDir="false" />
16   - <change beforePath="$PROJECT_DIR$/data/test_01_login.xlsx" beforeDir="false" afterPath="$PROJECT_DIR$/data/test_01_login.xlsx" afterDir="false" />
17   - <change beforePath="$PROJECT_DIR$/report/history.json" beforeDir="false" afterPath="$PROJECT_DIR$/report/history.json" afterDir="false" />
18   - <change beforePath="$PROJECT_DIR$/report/report.html" beforeDir="false" />
19   - <change beforePath="$PROJECT_DIR$/report/report2.html" beforeDir="false" afterPath="$PROJECT_DIR$/report/report2.html" afterDir="false" />
20   - <change beforePath="$PROJECT_DIR$/report/report3.html" beforeDir="false" afterPath="$PROJECT_DIR$/report/report3.html" afterDir="false" />
21   - <change beforePath="$PROJECT_DIR$/run.py" beforeDir="false" afterPath="$PROJECT_DIR$/run.py" afterDir="false" />
  11 + <change beforePath="$PROJECT_DIR$/testcase/test_03_teaching_affairs.py" beforeDir="false" afterPath="$PROJECT_DIR$/testcase/test_03_teaching_affairs.py" afterDir="false" />
22 12 <change beforePath="$PROJECT_DIR$/testcase/test_04_Internship_preparation.py" beforeDir="false" afterPath="$PROJECT_DIR$/testcase/test_04_Internship_preparation.py" afterDir="false" />
23   - <change beforePath="$PROJECT_DIR$/tools/fixture.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools/fixture.py" afterDir="false" />
  13 + <change beforePath="$PROJECT_DIR$/tools/handle_token.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools/handle_token.py" afterDir="false" />
24 14 </list>
25 15 <option name="SHOW_DIALOG" value="false" />
26 16 <option name="HIGHLIGHT_CONFLICTS" value="true" />
... ... @@ -63,17 +53,18 @@
63 53 <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
64 54 <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
65 55 <property name="WebServerToolWindowFactoryState" value="false" />
66   - <property name="last_opened_file_path" value="$PROJECT_DIR$/data/Internship_preparation" />
  56 + <property name="last_opened_file_path" value="$PROJECT_DIR$/data/student_practice" />
67 57 <property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
68 58 </component>
69 59 <component name="RecentsManager">
70 60 <key name="CopyFile.RECENT_KEYS">
  61 + <recent name="$PROJECT_DIR$/data/student_practice" />
71 62 <recent name="$PROJECT_DIR$/data/Internship_preparation" />
72 63 <recent name="$PROJECT_DIR$/data/teaching_affairs" />
73 64 <recent name="$PROJECT_DIR$/tools" />
74 65 </key>
75 66 </component>
76   - <component name="RunManager" selected="Python.run">
  67 + <component name="RunManager" selected="Python tests.Unittests in test_05_student_practice.py">
77 68 <configuration name="fixture (1)" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
78 69 <module name="yxly2" />
79 70 <option name="INTERPRETER_OPTIONS" value="" />
... ... @@ -96,7 +87,7 @@
96 87 <option name="INPUT_FILE" value="" />
97 88 <method v="2" />
98 89 </configuration>
99   - <configuration name="run" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
  90 + <configuration name="handle_token" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
100 91 <module name="yxly2" />
101 92 <option name="INTERPRETER_OPTIONS" value="" />
102 93 <option name="PARENT_ENVS" value="true" />
... ... @@ -104,12 +95,12 @@
104 95 <env name="PYTHONUNBUFFERED" value="1" />
105 96 </envs>
106 97 <option name="SDK_HOME" value="" />
107   - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
  98 + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/tools" />
108 99 <option name="IS_MODULE_SDK" value="true" />
109 100 <option name="ADD_CONTENT_ROOTS" value="true" />
110 101 <option name="ADD_SOURCE_ROOTS" value="true" />
111 102 <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
112   - <option name="SCRIPT_NAME" value="$PROJECT_DIR$/run.py" />
  103 + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tools/handle_token.py" />
113 104 <option name="PARAMETERS" value="" />
114 105 <option name="SHOW_COMMAND_LINE" value="false" />
115 106 <option name="EMULATE_TERMINAL" value="false" />
... ... @@ -118,22 +109,29 @@
118 109 <option name="INPUT_FILE" value="" />
119 110 <method v="2" />
120 111 </configuration>
121   - <configuration name="Unittests in test_02_system_management.py" type="tests" factoryName="Unittests" temporary="true" nameIsGenerated="true">
  112 + <configuration name="run" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
122 113 <module name="yxly2" />
123 114 <option name="INTERPRETER_OPTIONS" value="" />
124 115 <option name="PARENT_ENVS" value="true" />
  116 + <envs>
  117 + <env name="PYTHONUNBUFFERED" value="1" />
  118 + </envs>
125 119 <option name="SDK_HOME" value="" />
126   - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/testcase" />
  120 + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
127 121 <option name="IS_MODULE_SDK" value="true" />
128 122 <option name="ADD_CONTENT_ROOTS" value="true" />
129 123 <option name="ADD_SOURCE_ROOTS" value="true" />
130 124 <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
131   - <option name="_new_additionalArguments" value="&quot;&quot;" />
132   - <option name="_new_target" value="&quot;$PROJECT_DIR$/testcase/test_02_system_management.py&quot;" />
133   - <option name="_new_targetType" value="&quot;PATH&quot;" />
  125 + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/run.py" />
  126 + <option name="PARAMETERS" value="" />
  127 + <option name="SHOW_COMMAND_LINE" value="false" />
  128 + <option name="EMULATE_TERMINAL" value="false" />
  129 + <option name="MODULE_MODE" value="false" />
  130 + <option name="REDIRECT_INPUT" value="false" />
  131 + <option name="INPUT_FILE" value="" />
134 132 <method v="2" />
135 133 </configuration>
136   - <configuration name="Unittests in test_03_teaching_affairs.py" type="tests" factoryName="Unittests" temporary="true" nameIsGenerated="true">
  134 + <configuration name="Unittests in test_04_Internship_preparation.py" type="tests" factoryName="Unittests" temporary="true" nameIsGenerated="true">
137 135 <module name="yxly2" />
138 136 <option name="INTERPRETER_OPTIONS" value="" />
139 137 <option name="PARENT_ENVS" value="true" />
... ... @@ -144,11 +142,11 @@
144 142 <option name="ADD_SOURCE_ROOTS" value="true" />
145 143 <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
146 144 <option name="_new_additionalArguments" value="&quot;&quot;" />
147   - <option name="_new_target" value="&quot;$PROJECT_DIR$/testcase/test_03_teaching_affairs.py&quot;" />
  145 + <option name="_new_target" value="&quot;$PROJECT_DIR$/testcase/test_04_Internship_preparation.py&quot;" />
148 146 <option name="_new_targetType" value="&quot;PATH&quot;" />
149 147 <method v="2" />
150 148 </configuration>
151   - <configuration name="Unittests in test_04_Internship_preparation.py" type="tests" factoryName="Unittests" temporary="true" nameIsGenerated="true">
  149 + <configuration name="Unittests in test_05_student_practice.py" type="tests" factoryName="Unittests" temporary="true" nameIsGenerated="true">
152 150 <module name="yxly2" />
153 151 <option name="INTERPRETER_OPTIONS" value="" />
154 152 <option name="PARENT_ENVS" value="true" />
... ... @@ -159,24 +157,24 @@
159 157 <option name="ADD_SOURCE_ROOTS" value="true" />
160 158 <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
161 159 <option name="_new_additionalArguments" value="&quot;&quot;" />
162   - <option name="_new_target" value="&quot;$PROJECT_DIR$/testcase/test_04_Internship_preparation.py&quot;" />
  160 + <option name="_new_target" value="&quot;$PROJECT_DIR$/testcase/test_05_student_practice.py&quot;" />
163 161 <option name="_new_targetType" value="&quot;PATH&quot;" />
164 162 <method v="2" />
165 163 </configuration>
166 164 <list>
167 165 <item itemvalue="Python.run" />
168 166 <item itemvalue="Python.fixture (1)" />
169   - <item itemvalue="Python tests.Unittests in test_03_teaching_affairs.py" />
170   - <item itemvalue="Python tests.Unittests in test_02_system_management.py" />
  167 + <item itemvalue="Python.handle_token" />
171 168 <item itemvalue="Python tests.Unittests in test_04_Internship_preparation.py" />
  169 + <item itemvalue="Python tests.Unittests in test_05_student_practice.py" />
172 170 </list>
173 171 <recent_temporary>
174 172 <list>
  173 + <item itemvalue="Python tests.Unittests in test_05_student_practice.py" />
  174 + <item itemvalue="Python.handle_token" />
175 175 <item itemvalue="Python.run" />
176 176 <item itemvalue="Python tests.Unittests in test_04_Internship_preparation.py" />
177 177 <item itemvalue="Python.fixture (1)" />
178   - <item itemvalue="Python tests.Unittests in test_02_system_management.py" />
179   - <item itemvalue="Python tests.Unittests in test_03_teaching_affairs.py" />
180 178 </list>
181 179 </recent_temporary>
182 180 </component>
... ... @@ -207,7 +205,8 @@
207 205 <workItem from="1672796896009" duration="13130000" />
208 206 <workItem from="1672883098112" duration="23142000" />
209 207 <workItem from="1672969412942" duration="10384000" />
210   - <workItem from="1673228376200" duration="2158000" />
  208 + <workItem from="1673228376200" duration="16257000" />
  209 + <workItem from="1673317535549" duration="2485000" />
211 210 </task>
212 211 <task id="LOCAL-00001" summary="1.0.0&#10;首次提交">
213 212 <created>1671544396986</created>
... ... @@ -314,7 +313,14 @@
314 313 <option name="project" value="LOCAL" />
315 314 <updated>1672896427673</updated>
316 315 </task>
317   - <option name="localTasksCounter" value="16" />
  316 + <task id="LOCAL-00016" summary="版本:1.0.9&#10;1.新增发布项目用例">
  317 + <created>1673230697802</created>
  318 + <option name="number" value="00016" />
  319 + <option name="presentableId" value="LOCAL-00016" />
  320 + <option name="project" value="LOCAL" />
  321 + <updated>1673230697802</updated>
  322 + </task>
  323 + <option name="localTasksCounter" value="17" />
318 324 <servers />
319 325 </component>
320 326 <component name="TypeScriptGeneratedFilesManager">
... ... @@ -359,7 +365,8 @@
359 365 <MESSAGE value="版本:1.0.6&#10;1.需求院系名称由倒序改成正序排列,代码优化" />
360 366 <MESSAGE value="版本:1.0.7&#10;1.新增实习计划用例&#10;2.优化教师用例" />
361 367 <MESSAGE value="版本:1.0.8&#10;1.新增发布实习计划用例&#10;2.新增实习项目用例" />
362   - <option name="LAST_COMMIT_MESSAGE" value="版本:1.0.8&#10;1.新增发布实习计划用例&#10;2.新增实习项目用例" />
  368 + <MESSAGE value="版本:1.0.9&#10;1.新增发布项目用例" />
  369 + <option name="LAST_COMMIT_MESSAGE" value="版本:1.0.9&#10;1.新增发布项目用例" />
363 370 </component>
364 371 <component name="XDebuggerManager">
365 372 <breakpoint-manager>
... ... @@ -471,29 +478,39 @@
471 478 </line-breakpoint>
472 479 <line-breakpoint suspend="THREAD" type="python-line">
473 480 <url>file://$PROJECT_DIR$/testcase/test_04_Internship_preparation.py</url>
474   - <line>275</line>
  481 + <line>274</line>
475 482 <option name="timeStamp" value="62" />
476 483 </line-breakpoint>
477 484 <line-breakpoint suspend="THREAD" type="python-line">
478 485 <url>file://$PROJECT_DIR$/testcase/test_04_Internship_preparation.py</url>
479   - <line>250</line>
  486 + <line>249</line>
480 487 <option name="timeStamp" value="74" />
481 488 </line-breakpoint>
482 489 <line-breakpoint suspend="THREAD" type="python-line">
483 490 <url>file://$PROJECT_DIR$/testcase/test_04_Internship_preparation.py</url>
484   - <line>248</line>
  491 + <line>247</line>
485 492 <option name="timeStamp" value="75" />
486 493 </line-breakpoint>
487   - <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
  494 + <line-breakpoint suspend="THREAD" type="python-line">
488 495 <url>file://$PROJECT_DIR$/testcase/test_04_Internship_preparation.py</url>
489   - <line>323</line>
  496 + <line>322</line>
490 497 <option name="timeStamp" value="78" />
491 498 </line-breakpoint>
492   - <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
  499 + <line-breakpoint suspend="THREAD" type="python-line">
493 500 <url>file://$PROJECT_DIR$/testcase/test_04_Internship_preparation.py</url>
494   - <line>324</line>
  501 + <line>323</line>
495 502 <option name="timeStamp" value="79" />
496 503 </line-breakpoint>
  504 + <line-breakpoint suspend="THREAD" type="python-line">
  505 + <url>file://$PROJECT_DIR$/tools/handle_token.py</url>
  506 + <line>49</line>
  507 + <option name="timeStamp" value="80" />
  508 + </line-breakpoint>
  509 + <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
  510 + <url>file://$PROJECT_DIR$/testcase/test_05_student_practice.py</url>
  511 + <line>45</line>
  512 + <option name="timeStamp" value="84" />
  513 + </line-breakpoint>
497 514 </breakpoints>
498 515 <default-breakpoints>
499 516 <breakpoint type="python-exception">
... ... @@ -508,7 +525,9 @@
508 525 <SUITE FILE_PATH="coverage/yxly$Unittests_in_test_02_system_management_py.coverage" NAME="Unittests in test_02_system_management.py Coverage Results" MODIFIED="1672304630144" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/testcase" />
509 526 <SUITE FILE_PATH="coverage/yxly$fixture__1_.coverage" NAME="fixture (1) Coverage Results" MODIFIED="1672814917701" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tools" />
510 527 <SUITE FILE_PATH="coverage/yxly$Unittests_in_test_01_login_py.coverage" NAME="Unittests in test_01_login.py Coverage Results" MODIFIED="1671641941612" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/testcase" />
  528 + <SUITE FILE_PATH="coverage/yxly$Unittests_in_test_05_student_practice_py.coverage" NAME="Unittests in test_05_student_practice.py Coverage Results" MODIFIED="1673255797197" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/testcase" />
511 529 <SUITE FILE_PATH="coverage/yxly$fixture.coverage" NAME="fixture Coverage Results" MODIFIED="1671628017395" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/testcase" />
  530 + <SUITE FILE_PATH="coverage/yxly$handle_token.coverage" NAME="handle_token Coverage Results" MODIFIED="1673253014011" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tools" />
512 531 <SUITE FILE_PATH="coverage/yxly$Unittests_in_fixture_py.coverage" NAME="Unittests in fixture.py Coverage Results" MODIFIED="1671625806027" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/testcase" />
513 532 <SUITE FILE_PATH="coverage/yxly$Unittests_in_test_04_Internship_preparation_py.coverage" NAME="Unittests in test_04_Internship_preparation.py Coverage Results" MODIFIED="1673229942283" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/testcase" />
514 533 <SUITE FILE_PATH="coverage/yxly$Unittests_in_test_03_teaching_affairs_py.coverage" NAME="Unittests in test_03_teaching_affairs.py Coverage Results" MODIFIED="1672198781295" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/testcase" />
... ...
... ... @@ -19,10 +19,10 @@ Report_Path = os.path.join(Base_Path, "report")
19 19 Log_Path = os.path.join(Base_Path, "logs")
20 20 # 测试数据的Excel
21 21 DataExcel_Path = os.path.join(Base_Path, "data")
22   -# --------------------------------------------
  22 +# 配置文件的路径
  23 +Config_Path = os.path.join(Base_Path, "conf")
  24 +
23 25 TeachingAffairs_path = os.path.join(DataExcel_Path, "teaching_affairs") # 教务系统管理列表
24 26 System_path = os.path.join(DataExcel_Path, "system") # 系统管理列表
25 27 Internship_path = os.path.join(DataExcel_Path, "Internship_preparation") # 实习准备目录
26   -# --------------------------------------------
27   -# 配置文件的路径
28   -Config_Path = os.path.join(Base_Path, "conf")
  28 +Student_practice = os.path.join(DataExcel_Path, "student_practice") # 学生实习
... ...
... ... @@ -10,7 +10,7 @@ login_token = {"Authorization": "Basic"+" "+"d29ya2FpOjEyMzQ1Ng=="}
10 10
11 11
12 12 ;============================================================================================
13   -;用户数据
  13 +;学校用户数据
14 14 ;============================================================================================
15 15 [user_data]
16 16 ;账号
... ... @@ -33,7 +33,16 @@ way = name
33 33 ;company企业,
34 34 ;broker经纪人
35 35 type = teacher
36   -
  36 +;============================================================================================
  37 +;学生用户数据
  38 +;============================================================================================
  39 +[student_user_data]
  40 +;账号
  41 +phone = 17301249973
  42 +;密码
  43 +code = 8888
  44 +type = student
  45 +way = code
37 46
38 47
39 48 ;============================================================================================
... ...
... ... @@ -343,7 +343,7 @@ class Test04Student(unittest.TestCase):
343 343
344 344 @data(*add_student_case)
345 345 def test_add_student_info(self, case):
346   - """新增课程用例"""
  346 + """新增学生用例"""
347 347 url = conf.get("url", "url_ip") + case["url"]
348 348 # 准备数据
349 349 if "#name#" in case["data"]:
... ...
... ... @@ -188,7 +188,6 @@ class Test02publishInternshipPlan(unittest.TestCase):
188 188 herders["Authorization"] = self.token
189 189 # 调用接口
190 190 self.request = requests.request(url=url, method=case["method"], json=data, headers=herders)
191   - requests.request(url=url, method=case["method"], json=data, headers=herders)
192 191 res = self.request.json()
193 192 print("用例入参:{}".format(data))
194 193 print("预期结果:", expected)
... ...
  1 +# -*- coding: utf-8 -*-
  2 +# ======================================
  3 +# @Software: PyCharm
  4 +# @Author : Shitou ✊
  5 +# @Time : 2023/1/9 16:32
  6 +# @FileName: test_05_student_practice.py
  7 +# ======================================
  8 +"""
  9 +学生小程序首页界面"实习界面"
  10 +"""
  11 +import json
  12 +import os
  13 +import unittest
  14 +import requests
  15 +
  16 +from common.handle_config import conf
  17 +from common.handle_excel import Excel
  18 +from common.handle_log import HandleLog
  19 +from common.myddt import ddt, data
  20 +from common.handle_path import Student_practice
  21 +from tools.handle_token import StudentLoginToken
  22 +
  23 +
  24 +@ddt
  25 +class Test01SelectAllPractice(unittest.TestCase):
  26 + """学生查看全部实习"""
  27 + select_student_practice = Excel(os.path.join(Student_practice, "test_06__practice.xlsx"),
  28 + "select_internship_practice")
  29 + select_student_practice_case = select_student_practice.read_excel()
  30 +
  31 + @classmethod
  32 + def setUpClass(cls):
  33 + cls.token = StudentLoginToken.login_token()
  34 +
  35 + @data(*select_student_practice_case)
  36 + def test01select_allpatice(self, case):
  37 + # 准备数据
  38 + data = json.loads(case["data"])
  39 + expected = json.loads(case["expected"])
  40 +
  41 + # 调用接口
  42 + url = conf.get("url", "url_ip") + case["url"]
  43 + herders = {}
  44 + herders["Authorization"] = self.token
  45 + request = requests.request(url=url, method=case["method"], params=data, headers=herders)
  46 + res = request.json()
  47 + # 断言
  48 + try:
  49 + self.assertEqual(expected['msg'], res['msg'])
  50 + self.assertEqual(expected['code'], res['code'])
  51 + except AssertionError as e:
  52 + # 写入Excel
  53 + self.select_student_practice.write_excel(row=case["id"] + 1, column=7, value="不通过")
  54 + HandleLog.log.error("用例标题{},不通过".format(case['title']))
  55 + HandleLog.log.exception(e)
  56 + raise e
  57 + else:
  58 + self.select_student_practice.write_excel(row=case["id"] + 1, column=7, value="通过")
  59 + # 将创建使用的数据写入到excel表格中
  60 + self.select_student_practice.write_excel(row=case["id"] + 1, column=9, value=case["data"])
  61 + HandleLog.log.info("用例{},执行通过".format(case["title"]))
... ...
... ... @@ -33,5 +33,23 @@ class LoginToken:
33 33 return token
34 34
35 35
  36 +class StudentLoginToken:
  37 + def login_token():
  38 + # 登陆学生获取token
  39 + login_url = conf.get("url", "url_ip") + "/auth/v1/login"
  40 + headers = eval(conf.get('url', 'login_token'))
  41 + params = {
  42 + "way": conf.get("student_user_data", "way"),
  43 + "phone": conf.get("student_user_data", "phone"),
  44 + "code": conf.get("student_user_data", "code"),
  45 + "type": conf.get("student_user_data", "type")
  46 + }
  47 + response = requests.request(url=login_url, method="post", json=params, headers=headers)
  48 + res = response.json()
  49 + # 获取token
  50 + token = "Bearer" + " " + jsonpath(res, "$..access_token")[0]
  51 + return token
  52 +
  53 +
36 54 if __name__ == '__main__':
37   - LoginToken.login_token()
  55 + StudentLoginToken.login_token()
... ...
注册登录 后发表评论