Merge pull request #13091 from owncloud/fix-provisioning-api

Fix remaining unit tests for provisioning_api
This commit is contained in:
Morris Jobke 2015-01-03 22:41:44 +01:00
commit fcae87170d
5 changed files with 24 additions and 4 deletions

View File

@ -31,6 +31,11 @@ use \OC_SubAdmin;
class Groups{
public function setUp() {
// These seems to be deleted by another test.
OC_Group::createGroup('admin');
}
/**
* returns a list of groups
*/

View File

@ -70,7 +70,7 @@ class Users {
// Admin? Or SubAdmin?
if(OC_User::isAdminUser(OC_User::getUser()) || OC_SubAdmin::isUserAccessible(OC_User::getUser(), $userId)) {
// Check they exist
if(!OC_user::userExists($userId)) {
if(!OC_User::userExists($userId)) {
return new OC_OCS_Result(null, \OC_API::RESPOND_NOT_FOUND, 'The requested user could not be found');
}
// Show all

View File

@ -27,6 +27,9 @@ class Test_Provisioning_Api_Apps extends PHPUnit_Framework_TestCase {
private $users = array();
function setUp() {
OC_Group::createGroup('admin');
}
/**
* Generates a temp user
* @param $num int number of users to generate
@ -98,4 +101,8 @@ class Test_Provisioning_Api_Apps extends PHPUnit_Framework_TestCase {
}
function tearDown() {
OC_Group::deleteGroup('admin');
}
}

View File

@ -27,6 +27,11 @@ class Test_Provisioning_Api_Groups extends PHPUnit_Framework_TestCase {
private $users = array();
public function setUp() {
// These seems to be deleted by another test.
OC_Group::createGroup('admin');
}
/**
* Generates a temp user
* @param $num int number of users to generate
@ -145,10 +150,8 @@ class Test_Provisioning_Api_Groups extends PHPUnit_Framework_TestCase {
OC_Group::deleteGroup($group1);
$user1 = $this->generateUsers();
$user2 = $this->generateUsers();
OC_User::setUserId($user1);
OC_Group::addToGroup($user1, 'admin');
$group1 = uniqid();
$result = \OCA\provisioning_api\Groups::getSubAdminsOfGroup(array(
'groupid' => uniqid(),
));
@ -164,6 +167,7 @@ class Test_Provisioning_Api_Groups extends PHPUnit_Framework_TestCase {
foreach($this->users as $user) {
\OC_User::deleteUser($user);
}
OC_Group::deleteGroup('admin');
}

View File

@ -26,6 +26,10 @@ class Test_Provisioning_Api_Users extends PHPUnit_Framework_TestCase {
private $users = array();
public function setUp() {
OC_Group::createGroup('admin');
}
/**
* Generates a temp user
* @param $num int number of users to generate
@ -436,7 +440,6 @@ class Test_Provisioning_Api_Users extends PHPUnit_Framework_TestCase {
));
$this->assertInstanceOf('OC_OCS_Result', $result);
$this->assertFalse($result->succeeded());
$data = $result->getData();
OC_Group::deleteGroup($group);
}
@ -790,6 +793,7 @@ class Test_Provisioning_Api_Users extends PHPUnit_Framework_TestCase {
foreach($this->users as $user) {
\OC_User::deleteUser($user);
}
OC_Group::deleteGroup('admin');
}
}