Ensure admin group is present before running tests

This commit is contained in:
Tom Needham 2015-01-03 13:25:48 +00:00
parent 32d9563359
commit 97d31946c3
4 changed files with 10 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

@ -145,10 +145,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(),
));

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);
}