* [unittest] adjust gitlab unit test case.
This commit is contained in:
@@ -13,29 +13,36 @@ cid=1
|
||||
- 使用空的account更新gitlab用户第account条的0属性 @禅道用户不能为空
|
||||
- 设置了密码的情况下更新gitlab用户 @二次密码不一致!
|
||||
- 通过gitlabID,用户对象正确更新用户名字 @1
|
||||
- 通过gitlabID,用户对象错误更新用户名字 @该用户已经被绑定!
|
||||
- 通过gitlabID,用户对象错误更新用户名字 @该用户已经被绑定!
|
||||
|
||||
*/
|
||||
|
||||
zenData('pipeline')->gen(5);
|
||||
zenData('oauth')->gen(5);
|
||||
|
||||
global $app;
|
||||
$app->rawModule = 'gitlab';
|
||||
$app->rawMethod = 'browse';
|
||||
|
||||
$gitlab = $tester->loadModel('gitlab');
|
||||
|
||||
$gitlabID = 1;
|
||||
|
||||
/* Create user. */
|
||||
$user = new stdclass();
|
||||
$user->name = 'apiCreatedUser';
|
||||
$user->username = 'apiuser17';
|
||||
$user->email = 'apiuser17@test.com';
|
||||
$user->password = '12345678';
|
||||
$user->name = 'apiCreatedUser2';
|
||||
$user->username = 'apiuser19';
|
||||
$user->email = 'apiuser19@test.com';
|
||||
$user->password = '123Qwe!@#';
|
||||
$gitlab->apiCreateUser($gitlabID, $user);
|
||||
|
||||
/* Get userID. */
|
||||
$gitlabUsers = $gitlab->apiGetUsers($gitlabID);
|
||||
$userID = 0;
|
||||
foreach($gitlabUsers as $gitlabUser)
|
||||
{
|
||||
if($gitlabUser->account == 'apiuser17')
|
||||
if($gitlabUser->account == 'apiuser19')
|
||||
{
|
||||
$userID = $gitlabUser->id;
|
||||
break;
|
||||
@@ -54,3 +61,9 @@ r($gitlabTest->editUserTest($gitlabID, $user)) && p('password_repeat:0') && e('
|
||||
unset($user->password);
|
||||
$user->id = $userID;
|
||||
r($gitlabTest->editUserTest($gitlabID, $user)) && p() && e('1'); //通过gitlabID,用户对象正确更新用户名字
|
||||
|
||||
$user->id = 100000;
|
||||
r($gitlabTest->editUserTest($gitlabID, $user)) && p('account:0') && e('该用户已经被绑定!'); //通过gitlabID,用户对象错误更新用户名字
|
||||
|
||||
$user->id = -1;
|
||||
r($gitlabTest->editUserTest($gitlabID, $user)) && p('account:0') && e('该用户已经被绑定!'); //通过gitlabID,用户对象错误更新用户名字
|
||||
|
||||
Reference in New Issue
Block a user