MCPcopy
hub / github.com/YMFE/yapi / getCaseList

Method getCaseList

server/controllers/interfaceCol.js:134–153  ·  view source on GitHub ↗

* 获取一个接口集下的所有的测试用例 * @interface /col/case_list * @method GET * @category col * @foldnumber 10 * @param {String} col_id 接口集id * @returns {Object} * @example

(ctx)

Source from the content-addressed store, hash-verified

132 * @example
133 */
134 async getCaseList(ctx) {
135 try {
136 let id = ctx.query.col_id;
137 if (!id || id == 0) {
138 return (ctx.body = yapi.commons.resReturn(null, 407, 'col_id不能为空'));
139 }
140
141 let colData = await this.colModel.get(id);
142 let project = await this.projectModel.getBaseInfo(colData.project_id);
143 if (project.project_type === 'private') {
144 if ((await this.checkAuth(project._id, 'project', 'view')) !== true) {
145 return (ctx.body = yapi.commons.resReturn(null, 406, '没有权限'));
146 }
147 }
148
149 ctx.body = await yapi.commons.getCaseList(id);
150 } catch (e) {
151 ctx.body = yapi.commons.resReturn(null, 402, e.message);
152 }
153 }
154
155 /**
156 * 获取一个接口集下的所有的测试用例的环境变量

Callers 1

runAutoTestMethod · 0.80

Calls 3

getBaseInfoMethod · 0.80
getMethod · 0.45
checkAuthMethod · 0.45

Tested by

no test coverage detected