Merge branch 'sprint/167' into 'sprint/167_xiawenlong_api'
# Conflicts: # module/api/view/editlib.html.php
This commit is contained in:
@@ -78,7 +78,7 @@ class productEntry extends Entry
|
||||
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
$product = $this->product->getByID($productID);
|
||||
$this->sendSuccess(200, $this->format($product, 'createdDate:time'));
|
||||
$this->send(200, array('product' => $this->format($product, 'createdDate:time')));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,6 +28,8 @@ class userEntry extends Entry
|
||||
$control->profile($userID);
|
||||
|
||||
$data = $this->getData();
|
||||
if(!$data) return $this->send404(); // If no user, send 404.
|
||||
|
||||
$user = $data->data->user;
|
||||
unset($user->password);
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ CREATE TABLE `zt_apistruct_spec`
|
||||
`addedBy` varchar(30) NOT NULL DEFAULT 0,
|
||||
`addedDate` datetime NOT NULL,
|
||||
primary key (`id`)
|
||||
)
|
||||
);
|
||||
CREATE TABLE `zt_block` (
|
||||
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`account` char(30) NOT NULL,
|
||||
|
||||
+1
-1
@@ -101,4 +101,4 @@ CREATE TABLE `zt_apistruct_spec`
|
||||
`addedBy` varchar(30) NOT NULL DEFAULT 0,
|
||||
`addedDate` datetime NOT NULL,
|
||||
primary key (`id`)
|
||||
)
|
||||
);
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@ CREATE TABLE `zt_apistruct_spec`
|
||||
`addedBy` varchar(30) NOT NULL DEFAULT 0,
|
||||
`addedDate` datetime NOT NULL,
|
||||
primary key (`id`)
|
||||
)
|
||||
);
|
||||
-- DROP TABLE IF EXISTS `zt_block`;
|
||||
CREATE TABLE IF NOT EXISTS `zt_block` (
|
||||
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
|
||||
|
||||
@@ -617,7 +617,7 @@ class api extends control
|
||||
if(intval($libID) > 0)
|
||||
{
|
||||
$menu .= "<div class='dropdown' id='createDropdown'>";
|
||||
$menu .= "<button class='btn btn-primary' type='button' data-toggle='dropdown'><i class='icon icon-plus'></i> " . $this->lang->curd->create . " <span class='caret'></span></button>";
|
||||
$menu .= "<button class='btn btn-primary' type='button' data-toggle='dropdown'><i class='icon icon-plus'></i> " . $this->lang->api->createAB . " <span class='caret'></span></button>";
|
||||
$menu .= "<ul class='dropdown-menu pull-right'>";
|
||||
|
||||
/* check has permission create api doc */
|
||||
@@ -681,7 +681,7 @@ EOT;
|
||||
foreach($libs as $key => $lib)
|
||||
{
|
||||
$selected = $key == $libID ? 'selected' : '';
|
||||
$output .= html::a(inlink('index', "libID=$key"), $lib->name, '', "class='$selected' data-app='{$this->app->tab}'");
|
||||
$output .= html::a(inlink('index', "libID=$key"), $lib->name, '', "class='$selected' data-app='{$this->app->tab}'");
|
||||
}
|
||||
$output .= "</div></div></div></div></div>";
|
||||
|
||||
@@ -690,7 +690,7 @@ EOT;
|
||||
if(!empty($versions))
|
||||
{
|
||||
$versionName = $version > 0 ? $versions[$version]->version : $this->lang->api->defaultVersion;
|
||||
$output .= <<<EOT
|
||||
$output .= <<<EOT
|
||||
<div class='btn-group angle-btn'>
|
||||
<div class='btn-group'>
|
||||
<button id='currentBranch' data-toggle='dropdown' type='button' class='btn btn-limit'>{$versionName} <span class='caret'></span>
|
||||
|
||||
+20
-13
@@ -21,9 +21,11 @@ $lang->api->publish = 'Publish';
|
||||
$lang->api->editPublish = 'Edit Publish';
|
||||
$lang->api->createLib = 'Create Api Library';
|
||||
$lang->api->createApi = 'Create Api';
|
||||
$lang->api->createAB = 'Create';
|
||||
$lang->api->edit = 'Edit';
|
||||
$lang->api->delete = 'Delete';
|
||||
$lang->api->position = 'Positions';
|
||||
$lang->api->startLine = "%s,%s";
|
||||
$lang->api->desc = 'Description';
|
||||
$lang->api->debug = 'Debug';
|
||||
$lang->api->submit = 'Submit';
|
||||
@@ -52,8 +54,23 @@ $lang->api->basicInfo = 'Essential Information';
|
||||
$lang->api->apiDesc = 'Interface Description';
|
||||
$lang->api->confirmDelete = "Are you sure to delete this interface?";
|
||||
$lang->api->confirmDeleteLib = "Are you sure to delete this interface library?";
|
||||
$lang->api->filterStruct = "use struct";
|
||||
$lang->api->defaultVersion = "Current Version";
|
||||
|
||||
/* Common access control lang. */
|
||||
$lang->api->whiteList = 'White list';
|
||||
$lang->api->aclList['open'] = 'Open';
|
||||
$lang->api->aclList['private'] = 'Private';
|
||||
$lang->api->aclList['custom'] = 'Custom';
|
||||
$lang->api->group = 'Group';
|
||||
$lang->api->user = 'User';
|
||||
|
||||
$lang->api->noticeAcl = array(
|
||||
'open' => 'Users who can access the api library which the library belongs can access it.',
|
||||
'custom' => 'Users in the whiltelist can access it.',
|
||||
'private' => 'Only the one who created it can access it.',
|
||||
);
|
||||
|
||||
/* fields of struct */
|
||||
$lang->struct = new stdClass();
|
||||
|
||||
@@ -82,6 +99,7 @@ $lang->api->structAddedBy = 'Creator';
|
||||
$lang->api->structAddedDate = 'Created Time';
|
||||
$lang->api->name = 'Interface Library Name';
|
||||
$lang->api->baseUrl = 'Base Url';
|
||||
$lang->api->baseUrlDesc = 'Site or path. for example, api.zentao.com or /v1';
|
||||
$lang->api->desc = 'Description';
|
||||
$lang->api->control = 'Access Control';
|
||||
$lang->api->noLib = 'There is no interface library at present。';
|
||||
@@ -163,24 +181,13 @@ $lang->api->paramsTypeOptions = array(
|
||||
'double' => 'double',
|
||||
'decimal' => 'decimal'
|
||||
);
|
||||
|
||||
/* Api params */
|
||||
$lang->api->paramsTypeCustomOptions = array(
|
||||
'file' => 'file',
|
||||
'ref' => 'ref',
|
||||
);
|
||||
|
||||
$lang->api->position = 'Position';
|
||||
$lang->api->startLine = "%s,%s";
|
||||
$lang->api->desc = 'Description';
|
||||
$lang->api->debug = 'Debug';
|
||||
$lang->api->submit = 'Submit';
|
||||
$lang->api->url = 'Request URL';
|
||||
$lang->api->result = 'Results';
|
||||
$lang->api->status = 'Status';
|
||||
$lang->api->data = 'Data';
|
||||
$lang->api->noParam = 'No parameters required if GET Debug';
|
||||
$lang->api->post = 'Refer to page list if POST Debug';
|
||||
|
||||
$lang->api->structParamsOptons = array_merge($lang->api->paramsTypeOptions, array('file' => 'file', 'ref' => 'ref'));
|
||||
$lang->api->allParamsTypeOptions = array_merge($lang->api->paramsTypeOptions, $lang->api->paramsTypeCustomOptions);
|
||||
$lang->api->requiredOptions = array(0 => 'No', 1 => 'Yes');
|
||||
@@ -190,4 +197,4 @@ $lang->doclib->name = 'Interface Library Name';
|
||||
|
||||
$lang->api->error = new stdclass();
|
||||
$lang->api->error->onlySelect = 'SQL interface only allow SELECT query.';
|
||||
$lang->api->error->disabled = 'For security reasons, this feature is disabled. You can go to the config directory and modify the configuration item %s to open this function.';
|
||||
$lang->api->error->disabled = 'For security reasons, this feature is disabled. You can go to the config directory and modify the configuration item %s to open this function.';
|
||||
|
||||
@@ -21,6 +21,7 @@ $lang->api->deleteLib = '删除接口库';
|
||||
$lang->api->publish = '发布接口';
|
||||
$lang->api->createLib = '创建接口库';
|
||||
$lang->api->createApi = '创建接口';
|
||||
$lang->api->createAB = '创建';
|
||||
$lang->api->edit = '编辑接口';
|
||||
$lang->api->delete = '删除接口';
|
||||
$lang->api->position = '位置';
|
||||
@@ -56,6 +57,19 @@ $lang->api->confirmDeleteLib = "您确定删除该接口库吗?";
|
||||
$lang->api->filterStruct = "使用数据结构填充";
|
||||
$lang->api->defaultVersion = "当前版本";
|
||||
|
||||
$lang->api->whiteList = '白名单';
|
||||
$lang->api->aclList['open'] = '公开';
|
||||
$lang->api->aclList['private'] = '私有';
|
||||
$lang->api->aclList['custom'] = '自定义';
|
||||
$lang->api->group = '分组';
|
||||
$lang->api->user = '用户';
|
||||
|
||||
$lang->api->noticeAcl = array(
|
||||
'open' => '所有人都可以访问',
|
||||
'custom' => '白名单的用户可以访问',
|
||||
'private' => '只有创建者自己可以访问',
|
||||
);
|
||||
|
||||
/* fields of struct */
|
||||
$lang->struct = new stdClass();
|
||||
|
||||
@@ -84,6 +98,7 @@ $lang->api->structAddedBy = '创建人';
|
||||
$lang->api->structAddedDate = '创建时间';
|
||||
$lang->api->name = '接口库名称';
|
||||
$lang->api->baseUrl = '请求基路径';
|
||||
$lang->api->baseUrlDesc = '网址或者路径,比如 test.zentao.net 或者 /v1';
|
||||
$lang->api->desc = '描述';
|
||||
$lang->api->control = '访问控制';
|
||||
$lang->api->noLib = '暂时没有接口库。';
|
||||
@@ -166,11 +181,13 @@ $lang->api->paramsTypeOptions = array(
|
||||
'double' => 'double',
|
||||
'decimal' => 'decimal'
|
||||
);
|
||||
|
||||
/* Api params */
|
||||
$lang->api->paramsTypeCustomOptions = array(
|
||||
'file' => 'file',
|
||||
'ref' => 'ref',
|
||||
);
|
||||
|
||||
$lang->api->structParamsOptons = array_merge($lang->api->paramsTypeOptions, array('file' => 'file', 'ref' => 'ref'));
|
||||
$lang->api->allParamsTypeOptions = array_merge($lang->api->paramsTypeOptions, $lang->api->paramsTypeCustomOptions);
|
||||
$lang->api->requiredOptions = array(0 => '否', 1 => '是');
|
||||
|
||||
@@ -41,7 +41,7 @@ js::set('struct_paramsType', $lang->struct->paramsType);
|
||||
<table class='table table-form'>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td> <?php echo html::select('filter', $allStruct, '', "class='form-control chosen filterSelect'");?> </td>
|
||||
<td><?php echo html::select('filter', $allStruct, '', "class='form-control chosen filterSelect'");?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -28,24 +28,24 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->api->baseUrl?></th>
|
||||
<td style="width: 80%"><?php echo html::input('baseUrl', '', "class='form-control'")?></td>
|
||||
<td style="width: 80%"><?php echo html::input('baseUrl', '', "class='form-control' placeholder='" . $lang->api->baseUrlDesc . "'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->api->control;?></th>
|
||||
<td>
|
||||
<span><?php echo html::radio('acl', $lang->acl->aclList, 'open', "onchange='toggleAcl(this.value, \"lib\")'")?></span>
|
||||
<span class='text-info' id='noticeAcl'><?php echo $lang->noticeAcl['open'];?></span>
|
||||
<span><?php echo html::radio('acl', $lang->api->aclList, 'open', "onchange='toggleAcl(this.value, \"lib\")'")?></span>
|
||||
<span class='text-info' id='noticeAcl'><?php echo $lang->api->noticeAcl['open'];?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id='whiteListBox' class='hidden'>
|
||||
<th><?php echo $lang->acl->whiteList;?></th>
|
||||
<th><?php echo $lang->api->whiteList;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<span class='input-group-addon groups-addon'><?php echo $lang->acl->group?></span>
|
||||
<span class='input-group-addon groups-addon'><?php echo $lang->api->group?></span>
|
||||
<?php echo html::select('groups[]', $groups, '', "class='form-control chosen' multiple")?>
|
||||
</div>
|
||||
<div class='input-group'>
|
||||
<span class='input-group-addon'><?php echo $lang->acl->user?></span>
|
||||
<span class='input-group-addon'><?php echo $lang->api->user?></span>
|
||||
<?php echo html::select('users[]', $users, '', "class='form-control chosen' multiple")?>
|
||||
</div>
|
||||
</td>
|
||||
@@ -77,5 +77,5 @@
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<?php js::set('noticeAcl', $lang->noticeAcl);?>
|
||||
<?php js::set('noticeAcl', $lang->api->noticeAcl);?>
|
||||
<?php include '../../common/view/footer.lite.html.php';?>
|
||||
|
||||
@@ -33,12 +33,12 @@
|
||||
<tr>
|
||||
<th><?php echo $lang->api->control;?></th>
|
||||
<td>
|
||||
<span><?php echo html::radio('acl', $lang->acl->aclList, $doc->acl, "onchange='toggleAcl(this.value, \"lib\")'");?></span>
|
||||
<span class='text-info' id='noticeAcl'><?php echo $lang->noticeAcl['open'];?></span>
|
||||
<span><?php echo html::radio('acl', $lang->api->aclList, 'open', "onchange='toggleAcl(this.value, \"lib\")'")?></span>
|
||||
<span class='text-info' id='noticeAcl'><?php echo $lang->api->noticeAcl['open'];?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id='whiteListBox' class='<?php echo $doc->acl === 'custom' ? '' : 'hidden'; ?>'>
|
||||
<th><?php echo $lang->acl->whiteList;?></th>
|
||||
<tr id='whiteListBox' class='hidden'>
|
||||
<th><?php echo $lang->api->whiteList;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<span class='input-group-addon groups-addon'><?php echo $lang->acl->group?></span>
|
||||
@@ -75,11 +75,9 @@
|
||||
</tr>
|
||||
<tr id='aclBoxB'>
|
||||
<th><?php echo $lang->api->control;?></th>
|
||||
<td>
|
||||
<?php echo html::radio('acl', $lang->api->aclListB, 'open', "onchange='toggleAcl(this.value, \"lib\")'");?>
|
||||
</td>
|
||||
<td><?php echo html::radio('acl', $lang->api->aclListB, 'open', "onchange='toggleAcl(this.value, \"lib\")'")?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<?php js::set('noticeAcl', $lang->noticeAcl);?>
|
||||
<?php js::set('noticeAcl', $lang->api->noticeAcl);?>
|
||||
<?php include '../../common/view/footer.lite.html.php';?>
|
||||
|
||||
@@ -320,25 +320,6 @@ $lang->themes['pink'] = '芙蕖粉';
|
||||
$lang->themes['blackberry'] = '露莓黑';
|
||||
$lang->themes['classic'] = '经典蓝';
|
||||
|
||||
/* global access control lang */
|
||||
/* common access control lang */
|
||||
$lang->acl->whiteList = '白名单';
|
||||
$lang->acl->aclList['open'] = '公开';
|
||||
$lang->acl->aclList['private'] = '私有';
|
||||
$lang->acl->aclList['custom'] = '自定义';
|
||||
$lang->acl->group = '分组';
|
||||
$lang->acl->user = '用户';
|
||||
|
||||
$lang->noticeAcl = [
|
||||
'open' => '所有人都可以访问',
|
||||
'custom' => '白名单的用户可以访问',
|
||||
'private' => '只有创建者自己可以访问',
|
||||
];
|
||||
|
||||
/* 全局公众配置 */
|
||||
$lang->curd->create = '创建';
|
||||
|
||||
|
||||
/* 错误提示信息。*/
|
||||
$lang->error = new stdclass();
|
||||
$lang->error->companyNotFound = "您访问的域名 %s 没有对应的公司。";
|
||||
|
||||
@@ -424,3 +424,16 @@ $lang->changelog['15.0.rc1'][] = 'stakeholder-createExpect';
|
||||
$lang->changelog['15.0.rc1'][] = 'stakeholder-editExpect';
|
||||
$lang->changelog['15.0.rc1'][] = 'stakeholder-viewExpect';
|
||||
$lang->changelog['15.0.rc1'][] = 'stakeholder-userIssue';
|
||||
|
||||
$lang->changelog['15.7'][] = 'api-index';
|
||||
$lang->changelog['15.7'][] = 'api-createLib';
|
||||
$lang->changelog['15.7'][] = 'api-editLib';
|
||||
$lang->changelog['15.7'][] = 'api-deleteLib';
|
||||
$lang->changelog['15.7'][] = 'api-publish';
|
||||
$lang->changelog['15.7'][] = 'api-struct';
|
||||
$lang->changelog['15.7'][] = 'api-createStruct';
|
||||
$lang->changelog['15.7'][] = 'api-editStruct';
|
||||
$lang->changelog['15.7'][] = 'api-deleteStruct';
|
||||
$lang->changelog['15.7'][] = 'api-create';
|
||||
$lang->changelog['15.7'][] = 'api-edit';
|
||||
$lang->changelog['15.7'][] = 'api-delete';
|
||||
|
||||
@@ -63,6 +63,7 @@ $lang->group->copyOptions['copyPriv'] = 'Copy Privileges';
|
||||
$lang->group->copyOptions['copyUser'] = 'Copy Users';
|
||||
|
||||
$lang->group->versions[''] = 'History';
|
||||
$lang->group->versions['15_7'] = 'ZenTao15.7';
|
||||
$lang->group->versions['15_0_rc1'] = 'ZenTao15.0.rc1';
|
||||
$lang->group->versions['12_5'] = 'ZenTao12.5';
|
||||
$lang->group->versions['12_3'] = 'ZenTao12.3';
|
||||
|
||||
@@ -63,6 +63,7 @@ $lang->group->copyOptions['copyPriv'] = '复制权限';
|
||||
$lang->group->copyOptions['copyUser'] = '复制用户';
|
||||
|
||||
$lang->group->versions[''] = '修改历史';
|
||||
$lang->group->versions['15_7'] = '禅道15.7';
|
||||
$lang->group->versions['15_0_rc1'] = '禅道15.0.rc1';
|
||||
$lang->group->versions['12_5'] = '禅道12.5';
|
||||
$lang->group->versions['12_3'] = '禅道12.3';
|
||||
|
||||
@@ -63,6 +63,7 @@ $lang->group->copyOptions['copyPriv'] = '複製權限';
|
||||
$lang->group->copyOptions['copyUser'] = '複製用戶';
|
||||
|
||||
$lang->group->versions[''] = '修改歷史';
|
||||
$lang->group->versions['15_7'] = '禪道15.7';
|
||||
$lang->group->versions['15_0_rc1'] = '禪道15.0.rc1';
|
||||
$lang->group->versions['12_5'] = '禪道12.5';
|
||||
$lang->group->versions['12_3'] = '禪道12.3';
|
||||
|
||||
@@ -381,10 +381,11 @@ class groupModel extends model
|
||||
|
||||
/* Update whitelist. */
|
||||
$this->loadModel('personnel');
|
||||
$users = $this->getUserPairs($groupID);
|
||||
$users = array_keys($users);
|
||||
$users = $this->getUserPairs($groupID);
|
||||
$users = array_keys($users);
|
||||
$objectTypes = array_reverse($this->config->group->acl->objectTypes); //Adjust the order of object types, because execution is subordinate to the whitelist of projects, as well as products to programs.
|
||||
|
||||
foreach($this->config->group->acl->objectTypes as $key => $objectType)
|
||||
foreach($objectTypes as $key => $objectType)
|
||||
{
|
||||
$oldAcls = isset($oldGroup->acl[$key]) ? $oldGroup->acl[$key] : array();
|
||||
$newAcls = isset($actions[$key]) ? $actions[$key] : array();
|
||||
@@ -456,7 +457,9 @@ class groupModel extends model
|
||||
$acl = json_decode($acl);
|
||||
|
||||
$this->loadModel('personnel');
|
||||
foreach($this->config->group->acl->objectTypes as $key => $objectType)
|
||||
$objectTypes = array_reverse($this->config->group->acl->objectTypes); //Adjust the order of object types, because execution is subordinate to the whitelist of projects, as well as products to programs.
|
||||
|
||||
foreach($objectTypes as $key => $objectType)
|
||||
{
|
||||
if(!isset($acl->{$key})) continue;
|
||||
foreach($acl->{$key} as $objectID)
|
||||
|
||||
@@ -2478,7 +2478,7 @@ class storyModel extends model
|
||||
$story->planTitle = '';
|
||||
$storyPlans = explode(',', trim($story->plan, ','));
|
||||
foreach($storyPlans as $planID) $story->planTitle .= zget($plans, $planID, '') . ' ';
|
||||
$stories[] = $story;
|
||||
$stories[$story->id] = $story;
|
||||
}
|
||||
return $stories;
|
||||
}
|
||||
|
||||
@@ -723,6 +723,7 @@ class upgradeModel extends model
|
||||
$this->appendExec('15_5');
|
||||
case '15_6':
|
||||
$this->saveLogs('Execute 15_6');
|
||||
$this->execSQL($this->getUpgradeFile('15.6'));
|
||||
$this->appendExec('15_6');
|
||||
}
|
||||
|
||||
@@ -927,7 +928,7 @@ class upgradeModel extends model
|
||||
$confirmContent .= file_get_contents($xuanxuanSql);
|
||||
}
|
||||
case '15_5': $confirmContent .= file_get_contents($this->getUpgradeFile('15.5'));
|
||||
case '15_6':
|
||||
case '15_6': $confirmContent .= file_get_contents($this->getUpgradeFile('15.6'));
|
||||
}
|
||||
return str_replace('zt_', $this->config->db->prefix, $confirmContent);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试API 删除测试用例;
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
使用正确用例id删除用例 >> {"message":"success"}
|
||||
使用不存在的用例id删除用例 >> {"message":"success"}
|
||||
查询已删除的用例信息 >> 这个是测试用例1,1
|
||||
|
||||
*/
|
||||
global $token;
|
||||
$header = array('Token' => $token->token);
|
||||
|
||||
$deleteExist = $rest->delete('/testcases/1', $header);
|
||||
$deleteNotExist = $rest->delete('/testcases/10001', $header);
|
||||
|
||||
r($deleteExist) && c(200) && p() && e('{"message":"success"}'); // 使用正确用例id删除用例
|
||||
r($deleteNotExist) && c(200) && p() && e('{"message":"success"}'); // 使用不存在的用例id删除用例
|
||||
|
||||
$existCase = $rest->get('/testcases/1', $header);
|
||||
$existCase->body = array($existCase->body);
|
||||
|
||||
r($existCase) && c(200) && p('title,deleted') && e('这个是测试用例1,1'); // 查询已删除的用例信息
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试API 获取测试用例详情;
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
使用正确用例id查询用例详情 >> 这个是测试用例100
|
||||
使用不存在的用例id查询用例详情 >> 404 Not found
|
||||
|
||||
*/
|
||||
global $token;
|
||||
$header = array('Token' => $token->token);
|
||||
|
||||
$existCase = $rest->get('/testcases/100', $header);
|
||||
$noCase = $rest->get('/testcases/100001', $header);
|
||||
|
||||
$existCase->body = array($existCase->body);
|
||||
$noCase->body = array($noCase->body);
|
||||
|
||||
r($existCase) && c(200) && p('title') && e('这个是测试用例100'); // 使用正确用例id查询用例详情
|
||||
r($noCase) && c(404) && p('error') && e('404 Not found'); // 使用不存在的用例id查询用例详情
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试API 获取测试用例列表;
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
使用正确产品id查询用例列表的状态码 >> 200
|
||||
使用不存在的产品id查询用例列表的状态码 >> 200
|
||||
使用正确产品id获取用例列表的数量 >> 50
|
||||
使用不存在的产品id获取用例列表的数量 >> 0
|
||||
使用正确产品id获取用例列表 >> 这个是测试用例51,这个是测试用例52
|
||||
|
||||
*/
|
||||
global $token;
|
||||
$header = array('Token' => $token->token);
|
||||
|
||||
$existProductCases = $rest->get('/products/2/testcases?page=1&limit=100&order=id_asc', $header);
|
||||
$noProductCases = $rest->get('/products/1000/testcases?page=1&limit=10&order=id_asc', $header);
|
||||
|
||||
r($existProductCases->status_code) && p() && e('200'); // 使用正确产品id查询用例列表的状态码
|
||||
r($noProductCases->status_code) && p() && e('200'); // 使用不存在的产品id查询用例列表的状态码
|
||||
|
||||
$existCases = $existProductCases->body->testcases;
|
||||
$emptyCases = $noProductCases->body->testcases;
|
||||
|
||||
r(count($existCases)) && p() && e('50'); // 使用正确产品id获取用例列表的数量
|
||||
r(count($emptyCases)) && p() && e('0'); // 使用不存在的产品id获取用例列表的数量
|
||||
|
||||
r($existCases) && p('title') && e('这个是测试用例51,这个是测试用例52,这个是测试用例53,这个是测试用例54,这个是测试用例55,这个是测试用例56,这个是测试用例57,这个是测试用例58,这个是测试用例59,这个是测试用例60,这个是测试用例61,这个是测试用例62,这个是测试用例63,这个是测试用例64,这个是测试用例65,这个是测试用例66,这个是测试用例67,这个是测试用例68,这个是测试用例69,这个是测试用例70,这个是测试用例71,这个是测试用例72,这个是测试用例73,这个是测试用例74,这个是测试用例75,这个是测试用例76,这个是测试用例77,这个是测试用例78,这个是测试用例79,这个是测试用例80,这个是测试用例81,这个是测试用例82,这个是测试用例83,这个是测试用例84,这个是测试用例85,这个是测试用例86,这个是测试用例87,这个是测试用例88,这个是测试用例89,这个是测试用例90,这个是测试用例91,这个是测试用例92,这个是测试用例93,这个是测试用例94,这个是测试用例95,这个是测试用例96,这个是测试用例97,这个是测试用例98,这个是测试用例99,这个是测试用例100'); // 使用正确产品id获取用例列表
|
||||
@@ -0,0 +1,146 @@
|
||||
title: table zt_case
|
||||
desc: "测试用例"
|
||||
author: automated export
|
||||
version: "1.0"
|
||||
fields:
|
||||
- field: id
|
||||
note: "ID"
|
||||
range: 1-10000
|
||||
- field: product
|
||||
note: "产品ID"
|
||||
range: 1-180{50},0{1000}
|
||||
- field: branch
|
||||
note: "分支ID"
|
||||
range: 0
|
||||
- field: execution
|
||||
note: "执行ID"
|
||||
range: 0
|
||||
- field: lib
|
||||
note: "所属库"
|
||||
range: 0{9000},1-10{100}
|
||||
- field: module
|
||||
note: "所属模块"
|
||||
range: 0
|
||||
- field: path
|
||||
note: ""
|
||||
range: "0"
|
||||
- field: story
|
||||
note: "相关需求"
|
||||
range: "0"
|
||||
- field: storyVersion
|
||||
note: "需求版本"
|
||||
range: "1"
|
||||
- field: title
|
||||
note: "用例标题"
|
||||
range: "1-10000"
|
||||
prefix: "这个是测试用例"
|
||||
- field: precondition
|
||||
note: "前置条件"
|
||||
range: "1-10000"
|
||||
prefix: "这是前置条件"
|
||||
- field: keywords
|
||||
note: "关键词"
|
||||
range: "1-10000"
|
||||
prefix: "这是关键词"
|
||||
- field: pri
|
||||
note: "优先级"
|
||||
range: 1-4
|
||||
- field: type
|
||||
note: "用例类型"
|
||||
range: feature,performance,config,install,security,interface,other
|
||||
- field: auto
|
||||
note: "是否是自动化测试用例"
|
||||
range: "no"
|
||||
- field: frame
|
||||
note: "自动化测试框架"
|
||||
range: ""
|
||||
- field: stage
|
||||
note: "适用阶段"
|
||||
range: unittest,feature,intergrate,system,smoke,bvt
|
||||
- field: howRun
|
||||
note: "测试方式"
|
||||
range: ""
|
||||
- field: scriptedBy
|
||||
note: "脚本由谁创建"
|
||||
range: ""
|
||||
- field: scriptedDate
|
||||
note: "脚本创建日期"
|
||||
from: common.date.v1.yaml
|
||||
use: dateB
|
||||
- field: scriptStatus
|
||||
note: "脚本状态"
|
||||
range: ""
|
||||
- field: scriptLocation
|
||||
note: "脚本地址"
|
||||
range: ""
|
||||
- field: status
|
||||
note: "用例状态"
|
||||
range: wait,normal,blocked,investigate
|
||||
- field: subStatus
|
||||
note: "子状态"
|
||||
range: ""
|
||||
- field: color
|
||||
note: "标题颜色"
|
||||
from: common.color.v1.yaml
|
||||
use: color
|
||||
- field: frequency
|
||||
note: "使用频率"
|
||||
range: 1-3
|
||||
- field: order
|
||||
note: "排序"
|
||||
range: 1-500:5
|
||||
- field: openedBy
|
||||
note: "由谁创建"
|
||||
range: 1-100
|
||||
prefix: "test"
|
||||
- field: openedDate
|
||||
note: "创建日期"
|
||||
range: "-:600"
|
||||
type: timestamp
|
||||
format: "YYYY-MM-DD hh:mm:ss"
|
||||
- field: reviewedBy
|
||||
note: "由谁评审"
|
||||
range: admin
|
||||
- field: reviewedDate
|
||||
note: "评审时间"
|
||||
range: "-:300"
|
||||
type: timestamp
|
||||
format: "YYYY-MM-DD hh:mm:ss"
|
||||
- field: lastEditedBy
|
||||
note: "最后修改者"
|
||||
range: admin
|
||||
- field: lastEditedDate
|
||||
note: "修改日期"
|
||||
range: "-:300"
|
||||
type: timestamp
|
||||
format: "YYYY-MM-DD hh:mm:ss"
|
||||
- field: version
|
||||
note: "用例版本"
|
||||
range: "1"
|
||||
- field: linkCase
|
||||
note: "相关用例"
|
||||
range: 0
|
||||
- field: fromBug
|
||||
note: "来源Bug"
|
||||
range: 0
|
||||
- field: fromCaseID
|
||||
note: ""
|
||||
range: 0
|
||||
- field: fromCaseVersion
|
||||
note: ""
|
||||
range: 1
|
||||
- field: deleted
|
||||
note: "是否删除"
|
||||
range: 0{9950},1{50}
|
||||
- field: lastRunner
|
||||
note: "执行人"
|
||||
range: 1-100
|
||||
prefix: "test"
|
||||
- field: lastRunDate
|
||||
note: "执行时间"
|
||||
range: "-:500"
|
||||
type: timestamp
|
||||
format: "YYYY-MM-DD hh:mm:ss"
|
||||
- field: lastRunResult
|
||||
note: "结果"
|
||||
range: [pass,fail]
|
||||
@@ -26,3 +26,5 @@ $builder->release = array('rows' => 8, 'data' => array('release'));
|
||||
$builder->blockDefault = array('rows' => 150, 'data' => array('block', 'blockdefault'));
|
||||
$builder->blockRandom = array('rows' => 120, 'data' => array('block', 'blockrandom'));
|
||||
$builder->projectProduct = array('rows' => 21, 'data' => array('projectproduct'));
|
||||
|
||||
$builder->case = array('rows' => 10000, 'data' => array('case'));
|
||||
|
||||
@@ -1,302 +0,0 @@
|
||||
title: table zt_case
|
||||
desc: "测试用例"
|
||||
author: automated export
|
||||
version: "1.0"
|
||||
fields:
|
||||
- field: id
|
||||
note: "ID"
|
||||
range: "1-10000"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: product
|
||||
note: "产品ID"
|
||||
range: "1-10000"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: branch
|
||||
note: "分支ID"
|
||||
range: "0"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: lib
|
||||
note: "所属库"
|
||||
range: "0-1:R"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: module
|
||||
note: "所属模块"
|
||||
range: "1-10000"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: path
|
||||
note: ""
|
||||
range: "0"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: story
|
||||
note: "相关需求"
|
||||
range: "0"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: storyVersion
|
||||
note: "需求版本"
|
||||
range: "1"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: title
|
||||
note: "用例标题"
|
||||
range: "1-10000"
|
||||
prefix: "这个是测试用例"
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: precondition
|
||||
note: "前置条件"
|
||||
range: "1-10000"
|
||||
prefix: "这是前置条件"
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: keywords
|
||||
note: "关键词"
|
||||
range: "1-10000"
|
||||
prefix: "这是关键词"
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: pri
|
||||
note: "优先级"
|
||||
range: 1-4
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: type
|
||||
note: "用例类型"
|
||||
range: feature,performance,config,install,security,interface,other
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: auto
|
||||
range: "no"
|
||||
note: ""
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: frame
|
||||
note: ""
|
||||
range: "0"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: stage
|
||||
note: "适用阶段"
|
||||
range: unittest,feature,intergrate,system,smoke,bvt
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: howRun
|
||||
note: ""
|
||||
range: "0"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: scriptedBy
|
||||
note: ""
|
||||
range: "0"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: scriptedDate
|
||||
note: ""
|
||||
from: common.date.v1.yaml
|
||||
use: dateB
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: scriptStatus
|
||||
note: ""
|
||||
range: "0"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: scriptLocation
|
||||
note: ""
|
||||
range: "0"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: status
|
||||
note: "用例状态"
|
||||
range: wait,normal,blocked,investigate
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: subStatus
|
||||
note: "子状态"
|
||||
range: "0"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: color
|
||||
note: "标题颜色"
|
||||
from: common.color.v1.yaml
|
||||
use: color
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: frequency
|
||||
note: ""
|
||||
range: "0"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: order
|
||||
note: "排序"
|
||||
range: "1-100:5"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: openedBy
|
||||
note: "由谁创建"
|
||||
from: common.user.v1.yaml
|
||||
use: user
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: openedDate
|
||||
note: "创建日期"
|
||||
from: common.date.v1.yaml
|
||||
use: dateA
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: reviewedBy
|
||||
note: "由谁评审"
|
||||
from: common.user.v1.yaml
|
||||
use: user
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: reviewedDate
|
||||
note: "评审时间"
|
||||
prefix: ""
|
||||
from: common.date.v1.yaml
|
||||
use: dateA
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: lastEditedBy
|
||||
note: "最后修改者"
|
||||
from: common.user.v1.yaml
|
||||
use: user
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: lastEditedDate
|
||||
note: "修改日期"
|
||||
from: common.date.v1.yaml
|
||||
use: dateA
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: version
|
||||
note: "用例版本"
|
||||
range: "1"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: linkCase
|
||||
note: "相关用例"
|
||||
range: "0"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: fromBug
|
||||
note: "来源Bug"
|
||||
range: "0"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: fromCaseID
|
||||
note: ""
|
||||
range: "0"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: fromCaseVersion
|
||||
note: ""
|
||||
range: "0"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: deleted
|
||||
note: "是否删除"
|
||||
range: "0"
|
||||
prefix: "0"
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: lastRunner
|
||||
note: "执行人"
|
||||
from: common.user.v1.yaml
|
||||
use: user
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: lastRunDate
|
||||
note: "执行时间"
|
||||
from: common.date.v1.yaml
|
||||
use: dateA
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: lastRunResult
|
||||
note: "结果"
|
||||
range: "pass,0"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
+1
-1
@@ -84,7 +84,7 @@ function r($result)
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function p($key, $delimiter = ',')
|
||||
function p($key = '', $delimiter = ',')
|
||||
{
|
||||
global $_result;
|
||||
echo ">> ";
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ class rest
|
||||
$headers['Accept'] = 'application/json';
|
||||
$headers['Content-Type'] = 'application/json';
|
||||
|
||||
$resp = requests::put($this->base . $url, $headers, $data, $options);
|
||||
$resp = requests::put($this->base . $url, $headers, $data, $options = array());
|
||||
try
|
||||
{
|
||||
$resp->body = json_decode($resp->body);
|
||||
|
||||
Reference in New Issue
Block a user