diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/provisioning_api/lib/groups.php | 5 | ||||
-rw-r--r-- | apps/provisioning_api/lib/users.php | 2 | ||||
-rw-r--r-- | apps/provisioning_api/tests/AppsTest.php | 7 | ||||
-rw-r--r-- | apps/provisioning_api/tests/groupsTest.php | 8 | ||||
-rw-r--r-- | apps/provisioning_api/tests/usersTest.php | 6 |
5 files changed, 24 insertions, 4 deletions
diff --git a/apps/provisioning_api/lib/groups.php b/apps/provisioning_api/lib/groups.php index 4440c5bf509..ca714f7cc38 100644 --- a/apps/provisioning_api/lib/groups.php +++ b/apps/provisioning_api/lib/groups.php @@ -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 */ diff --git a/apps/provisioning_api/lib/users.php b/apps/provisioning_api/lib/users.php index 891264a908a..4262dff7a6c 100644 --- a/apps/provisioning_api/lib/users.php +++ b/apps/provisioning_api/lib/users.php @@ -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 diff --git a/apps/provisioning_api/tests/AppsTest.php b/apps/provisioning_api/tests/AppsTest.php index 2a269450ccd..c68259d1756 100644 --- a/apps/provisioning_api/tests/AppsTest.php +++ b/apps/provisioning_api/tests/AppsTest.php @@ -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'); + } + } diff --git a/apps/provisioning_api/tests/groupsTest.php b/apps/provisioning_api/tests/groupsTest.php index 0fb6e18a3eb..280e4792ff7 100644 --- a/apps/provisioning_api/tests/groupsTest.php +++ b/apps/provisioning_api/tests/groupsTest.php @@ -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'); } diff --git a/apps/provisioning_api/tests/usersTest.php b/apps/provisioning_api/tests/usersTest.php index b464a2e5fd0..381baa633e4 100644 --- a/apps/provisioning_api/tests/usersTest.php +++ b/apps/provisioning_api/tests/usersTest.php @@ -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'); } } |