znt/module/gogs/test/model/apigetusers.php

39 lines
1,001 B
PHP
Executable file
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env php
<?php
/**
title=测试 gogsModel::apiGetUsers();
timeout=0
cid=16689
- 错误的服务器ID @0
- 正确的服务器ID
- 第0条的realname属性 @gogs-admin
- 第1条的realname属性 @unittest
- 正确的服务器ID查询绑定过的用户
- 第0条的realname属性 @unittest
- 第1条的realname属性 @unittest1
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
zenData('pipeline')->gen(5);
zenData('oauth')->loadYaml('oauth')->gen(5);
su('admin');
global $app;
$app->rawModule = 'gogs';
$app->rawMethod = 'browse';
global $tester;
$gogsModel = $tester->loadModel('gogs');
$gogsID = 1;
r($gogsModel->apiGetUsers($gogsID)) && p() && e('0'); // 错误的服务器ID
$gogsID = 5;
r($gogsModel->apiGetUsers($gogsID, false)) && p('0:realname;1:realname') && e('gogs-admin,unittest'); // 正确的服务器ID
r($gogsModel->apiGetUsers($gogsID, true)) && p('0:realname;1:realname') && e('unittest,unittest1'); // 正确的服务器ID查询绑定过的用户