summaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api
diff options
context:
space:
mode:
authorTom Needham <tom@owncloud.com>2015-01-03 13:25:48 +0000
committerTom Needham <tom@owncloud.com>2015-01-03 13:25:48 +0000
commit97d31946c3d4cfdac46f91385b3d888fde30d934 (patch)
treec6553b59f7619c718b4ad3b7a9e9ddf2436e8ef2 /apps/provisioning_api
parent32d95633594547faaf841d90d970bf333a0c9282 (diff)
downloadnextcloud-server-97d31946c3d4cfdac46f91385b3d888fde30d934.tar.gz
nextcloud-server-97d31946c3d4cfdac46f91385b3d888fde30d934.zip
Ensure admin group is present before running tests
Diffstat (limited to 'apps/provisioning_api')
-rw-r--r--apps/provisioning_api/lib/groups.php5
-rw-r--r--apps/provisioning_api/lib/users.php2
-rw-r--r--apps/provisioning_api/tests/groupsTest.php2
-rw-r--r--apps/provisioning_api/tests/usersTest.php5
4 files changed, 10 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/groupsTest.php b/apps/provisioning_api/tests/groupsTest.php
index 0fb6e18a3eb..14d6f46dbfc 100644
--- a/apps/provisioning_api/tests/groupsTest.php
+++ b/apps/provisioning_api/tests/groupsTest.php
@@ -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(),
));
diff --git a/apps/provisioning_api/tests/usersTest.php b/apps/provisioning_api/tests/usersTest.php
index b464a2e5fd0..34df2769b21 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);
}