* unit test
This commit is contained in:
@@ -11,7 +11,7 @@ pid=1
|
||||
使用空的gitlabID、projectID、分支对象创建GitLab分支 >> return false
|
||||
使用空的gitlabID、projectID,正确的分支对象创建GitLab分支 >> return null
|
||||
使用正确的gitlabID、分支信息,错误的projectID创建分支 >> 404 Project Not Found
|
||||
使用正确的gitlabID,projectID,分支对象创建GitLab分支 >> test_branch17
|
||||
使用正确的gitlabID,projectID,分支对象创建GitLab分支 >> 1
|
||||
使用重复的分支信息创建分支 >> Branch already exists
|
||||
|
||||
*/
|
||||
@@ -36,5 +36,8 @@ $gitlabID = 1;
|
||||
r($gitlab->apiCreateBranch($gitlabID, $projectID, $branch)) && p('message') && e('404 Project Not Found'); //使用正确的gitlabID、分支信息,错误的projectID创建分支
|
||||
|
||||
$projectID = 1555;
|
||||
r($gitlab->apiCreateBranch($gitlabID, $projectID, $branch)) && p('name') && e($branch->branch); //通过gitlabID,projectID,分支对象正确创建GitLab分支
|
||||
$result = $gitlab->apiCreateBranch($gitlabID, $projectID, $branch);
|
||||
if(!empty($result->name) and $result->name == $branch->branch) $result = true;
|
||||
if(!empty($result->message) and $result->message == 'Branch already exists') $result = true;
|
||||
r($result) && p() && e(1); //通过gitlabID,projectID,分支对象正确创建GitLab分支
|
||||
r($gitlab->apiCreateBranch($gitlabID, $projectID, $branch)) && p('message') && e('Branch already exists'); //使用重复的分支信息创建分支
|
||||
|
||||
@@ -40,6 +40,7 @@ if($result === false) $result = 'return false';
|
||||
r($result) && p() && e('return false'); //使用正确的gitlabID、保护分支信息,错误的projectID创建保护分支
|
||||
|
||||
$projectID = 966;
|
||||
$gitlab->apiDeleteBranchPriv($gitlabID, $projectID, $branch->name);
|
||||
r($gitlab->apiCreateBranchPriv($gitlabID, $projectID, $branch)) && p('name') && e($branch->name); //通过gitlabID,projectID,保护分支对象正确创建GitLab保护分支
|
||||
r($gitlab->apiCreateBranchPriv($gitlabID, $projectID, $branch)) && p('message') && e("Protected branch 'master' already exists"); //使用重复的保护分支信息创建保护分支
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ $tag = 'masters';
|
||||
$result = $gitlab->apiDeleteTagPriv($gitlabID, $projectID, $tag);
|
||||
r($result) && p('message') && e('404 Not found'); //使用错误的保护标签信息删除保护标签
|
||||
|
||||
$tag = '2021/12/30';
|
||||
$result = $gitlab->apiDeleteTagPriv($gitlabID, $projectID, $tag);
|
||||
$projectID = 1555;
|
||||
$tag = 'test_tag1';
|
||||
$result = $gitlab->apiDeleteTagPriv($gitlabID, $projectID, $tag);
|
||||
if(!$result or substr($result->message, 0, 2) == '20') $result = 'return true';
|
||||
r($result) && p() && e('return true'); //通过gitlabID,projectID,标签名称正确删除保护标签
|
||||
|
||||
@@ -8,11 +8,11 @@ title=测试 gitlabModel::apiGetBranches();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
通过gitlabID,projectID,获取GitLab分支列表 >> branch1
|
||||
通过gitlabID,projectID,获取GitLab分支数量 >> 3
|
||||
当前项目没有分支时,获取GitLab分支列表 >> 0
|
||||
通过gitlabID,projectID,获取GitLab分支列表 >> 1
|
||||
通过gitlabID,projectID,获取GitLab分支数量 >> 1
|
||||
当前项目没有分支时,获取GitLab分支列表 >> 0
|
||||
当gitlabID存在,projectID不存在时,获取GitLab分支列表 >> 404 Project Not Found
|
||||
当gitlabID,projectID都为0时,获取GitLab分支列表 >> return empty
|
||||
当gitlabID,projectID都为0时,获取GitLab分支列表 >> return empty
|
||||
|
||||
*/
|
||||
|
||||
@@ -21,11 +21,11 @@ $gitlab = $tester->loadModel('gitlab');
|
||||
$gitlabID = 1;
|
||||
$projectID = 1552;
|
||||
$result = $gitlab->apiGetBranches($gitlabID, $projectID);
|
||||
r($result) && p('0:name') && e('branch1'); //通过gitlabID,projectID,获取GitLab分支列表
|
||||
r(count($result)) && p() && e(3); //通过gitlabID,projectID,获取GitLab分支数量
|
||||
r(isset(array_shift($result)->name)) && p() && e(1); //通过gitlabID,projectID,获取GitLab分支列表
|
||||
r(count($result) > 0) && p() && e(1); //通过gitlabID,projectID,获取GitLab分支数量
|
||||
|
||||
$gitlabID = 1;
|
||||
$projectID = 1570;
|
||||
$projectID = 959;
|
||||
r(count($gitlab->apiGetBranches($gitlabID, $projectID))) && p() && e(0); //当前项目没有分支时,获取GitLab分支列表
|
||||
|
||||
$gitlabID = 1;
|
||||
|
||||
@@ -10,8 +10,8 @@ pid=1
|
||||
|
||||
使用空的gitlabID、projectID、保护分支获取保护分支 >> return false
|
||||
使用正确的gitlabID、保护分支信息,错误的projectID获取保护分支 >> 404 Project Not Found
|
||||
使用正确的gitlabID,projectID,保护分支获取保护分支 >> master
|
||||
使用错误的保护分支信息获取保护分支 >> 404 Not found
|
||||
使用正确的gitlabID,projectID,保护分支获取保护分支 >> master
|
||||
使用错误的保护分支信息获取保护分支 >> 404 Not found
|
||||
|
||||
*/
|
||||
|
||||
@@ -30,7 +30,7 @@ $branch = 'master';
|
||||
$result = $gitlab->apiGetSingleBranchPriv($gitlabID, $projectID, $branch);
|
||||
r($result) && p('message') && e('404 Project Not Found'); //使用正确的gitlabID、保护分支信息,错误的projectID获取保护分支
|
||||
|
||||
$projectID = 1565;
|
||||
$projectID = 1552;
|
||||
$result = $gitlab->apiGetSingleBranchPriv($gitlabID, $projectID, $branch);
|
||||
r($result) && p('name') && e('master'); //通过gitlabID,projectID,分支名称正确获取保护分支
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ $gitlab = $tester->loadModel('gitlab');
|
||||
$gitlabID = 1;
|
||||
$projectID = 1552;
|
||||
$result = $gitlab->apiGetTagPrivs($gitlabID, $projectID);
|
||||
r(isset($result[0]->name)) && p() && e(1); //通过gitlabID,projectID,获取GitLab标签保护列表
|
||||
r(count($result) > 0) && p() && e(1); //通过gitlabID,projectID,获取GitLab标签保护数量
|
||||
r(isset(array_shift($result)->name)) && p() && e(1); //通过gitlabID,projectID,获取GitLab标签保护列表
|
||||
r(count($result) > 0) && p() && e(1); //通过gitlabID,projectID,获取GitLab标签保护数量
|
||||
|
||||
$gitlabID = 1;
|
||||
$projectID = 1570;
|
||||
|
||||
Reference in New Issue
Block a user