aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/tests
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap/tests')
-rw-r--r--apps/user_ldap/tests/configuration.php106
-rw-r--r--apps/user_ldap/tests/group_ldap.php1
-rw-r--r--apps/user_ldap/tests/integration/lib/integrationtestuserhome.php21
-rw-r--r--apps/user_ldap/tests/integration/lib/user/IntegrationTestUserAvatar.php21
-rw-r--r--apps/user_ldap/tests/integration/setup-scripts/createExplicitGroups.php21
-rw-r--r--apps/user_ldap/tests/integration/setup-scripts/createExplicitGroupsDifferentOU.php21
-rw-r--r--apps/user_ldap/tests/integration/setup-scripts/createExplicitUsers.php21
-rw-r--r--apps/user_ldap/tests/wizard.php1
8 files changed, 205 insertions, 8 deletions
diff --git a/apps/user_ldap/tests/configuration.php b/apps/user_ldap/tests/configuration.php
new file mode 100644
index 00000000000..efe4d7eec83
--- /dev/null
+++ b/apps/user_ldap/tests/configuration.php
@@ -0,0 +1,106 @@
+<?php
+/**
+ * @author Arthur Schiwon <blizzz@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCA\user_ldap\tests;
+
+class Test_Configuration extends \Test\TestCase {
+
+ public function configurationDataProvider() {
+ $inputWithDN = array(
+ 'cn=someUsers,dc=example,dc=org',
+ ' ',
+ ' cn=moreUsers,dc=example,dc=org '
+ );
+ $expectWithDN = array(
+ 'cn=someUsers,dc=example,dc=org',
+ 'cn=moreUsers,dc=example,dc=org'
+ );
+
+ $inputNames = array(
+ ' uid ',
+ 'cn ',
+ ' ',
+ '',
+ ' whats my name',
+ ' '
+ );
+ $expectedNames = array('uid', 'cn', 'whats my name');
+
+ $inputString = ' alea iacta est ';
+ $expectedString = 'alea iacta est';
+
+ $inputHomeFolder = array(
+ ' homeDirectory ',
+ ' attr:homeDirectory ',
+ ' '
+ );
+
+ $expectedHomeFolder = array(
+ 'attr:homeDirectory', 'attr:homeDirectory', ''
+ );
+
+ $password = ' such a passw0rd ';
+
+ return array(
+ 'set general base' => array('ldapBase', $inputWithDN, $expectWithDN),
+ 'set user base' => array('ldapBaseUsers', $inputWithDN, $expectWithDN),
+ 'set group base' => array('ldapBaseGroups', $inputWithDN, $expectWithDN),
+
+ 'set search attributes users' => array('ldapAttributesForUserSearch', $inputNames, $expectedNames),
+ 'set search attributes groups' => array('ldapAttributesForGroupSearch', $inputNames, $expectedNames),
+
+ 'set user filter objectclasses' => array('ldapUserFilterObjectclass', $inputNames, $expectedNames),
+ 'set user filter groups' => array('ldapUserFilterGroups', $inputNames, $expectedNames),
+ 'set group filter objectclasses' => array('ldapGroupFilterObjectclass', $inputNames, $expectedNames),
+ 'set group filter groups' => array('ldapGroupFilterGroups', $inputNames, $expectedNames),
+ 'set login filter attributes' => array('ldapLoginFilterAttributes', $inputNames, $expectedNames),
+
+ 'set agent password' => array('ldapAgentPassword', $password, $password),
+
+ 'set home folder, variant 1' => array('homeFolderNamingRule', $inputHomeFolder[0], $expectedHomeFolder[0]),
+ 'set home folder, variant 2' => array('homeFolderNamingRule', $inputHomeFolder[1], $expectedHomeFolder[1]),
+ 'set home folder, empty' => array('homeFolderNamingRule', $inputHomeFolder[2], $expectedHomeFolder[2]),
+
+ // default behaviour, one case is enough, special needs must be tested
+ // individually
+ 'set string value' => array('ldapHost', $inputString, $expectedString),
+ );
+ }
+
+ /**
+ * @dataProvider configurationDataProvider
+ */
+ public function testSetValue($key, $input, $expected) {
+ $configuration = new \OCA\user_ldap\lib\Configuration('t01', false);
+
+ $settingsInput = array(
+ 'ldapBaseUsers' => array(
+ 'cn=someUsers,dc=example,dc=org',
+ ' ',
+ ' cn=moreUsers,dc=example,dc=org '
+ )
+ );
+
+ $configuration->setConfiguration([$key => $input]);
+ $this->assertSame($configuration->$key, $expected);
+ }
+
+}
diff --git a/apps/user_ldap/tests/group_ldap.php b/apps/user_ldap/tests/group_ldap.php
index 7007afd5162..132fbfdf687 100644
--- a/apps/user_ldap/tests/group_ldap.php
+++ b/apps/user_ldap/tests/group_ldap.php
@@ -1,6 +1,7 @@
<?php
/**
* @author Arthur Schiwon <blizzz@owncloud.com>
+ * @author Frédéric Fortier <frederic.fortier@oronospolytechnique.com>
* @author Joas Schilling <nickvergessen@owncloud.com>
* @author Morris Jobke <hey@morrisjobke.de>
*
diff --git a/apps/user_ldap/tests/integration/lib/integrationtestuserhome.php b/apps/user_ldap/tests/integration/lib/integrationtestuserhome.php
index f34fca81c2d..ef000286109 100644
--- a/apps/user_ldap/tests/integration/lib/integrationtestuserhome.php
+++ b/apps/user_ldap/tests/integration/lib/integrationtestuserhome.php
@@ -1,9 +1,22 @@
<?php
/**
- * Created by PhpStorm.
- * User: blizzz
- * Date: 06.08.15
- * Time: 08:19
+ * @author Arthur Schiwon <blizzz@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
*/
namespace OCA\user_ldap\tests\integration\lib;
diff --git a/apps/user_ldap/tests/integration/lib/user/IntegrationTestUserAvatar.php b/apps/user_ldap/tests/integration/lib/user/IntegrationTestUserAvatar.php
index a03d6b0c0c6..6bb8afc01a2 100644
--- a/apps/user_ldap/tests/integration/lib/user/IntegrationTestUserAvatar.php
+++ b/apps/user_ldap/tests/integration/lib/user/IntegrationTestUserAvatar.php
@@ -1,5 +1,24 @@
<?php
-
+/**
+ * @author Arthur Schiwon <blizzz@owncloud.com>
+ * @author Morris Jobke <hey@morrisjobke.de>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
use OCA\user_ldap\lib\user\User;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\user_ldap\tests\integration\AbstractIntegrationTest;
diff --git a/apps/user_ldap/tests/integration/setup-scripts/createExplicitGroups.php b/apps/user_ldap/tests/integration/setup-scripts/createExplicitGroups.php
index 68854de5571..8ac35a54528 100644
--- a/apps/user_ldap/tests/integration/setup-scripts/createExplicitGroups.php
+++ b/apps/user_ldap/tests/integration/setup-scripts/createExplicitGroups.php
@@ -1,5 +1,24 @@
<?php
-
+/**
+ * @author Arthur Schiwon <blizzz@owncloud.com>
+ * @author Morris Jobke <hey@morrisjobke.de>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
if(php_sapi_name() !== 'cli') {
print('Only via CLI, please.');
exit(1);
diff --git a/apps/user_ldap/tests/integration/setup-scripts/createExplicitGroupsDifferentOU.php b/apps/user_ldap/tests/integration/setup-scripts/createExplicitGroupsDifferentOU.php
index 361881969cc..e22b72c452c 100644
--- a/apps/user_ldap/tests/integration/setup-scripts/createExplicitGroupsDifferentOU.php
+++ b/apps/user_ldap/tests/integration/setup-scripts/createExplicitGroupsDifferentOU.php
@@ -1,5 +1,24 @@
<?php
-
+/**
+ * @author Arthur Schiwon <blizzz@owncloud.com>
+ * @author Morris Jobke <hey@morrisjobke.de>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
if(php_sapi_name() !== 'cli') {
print('Only via CLI, please.');
exit(1);
diff --git a/apps/user_ldap/tests/integration/setup-scripts/createExplicitUsers.php b/apps/user_ldap/tests/integration/setup-scripts/createExplicitUsers.php
index bb784d60f7b..3e9cb674254 100644
--- a/apps/user_ldap/tests/integration/setup-scripts/createExplicitUsers.php
+++ b/apps/user_ldap/tests/integration/setup-scripts/createExplicitUsers.php
@@ -1,5 +1,24 @@
<?php
-
+/**
+ * @author Arthur Schiwon <blizzz@owncloud.com>
+ * @author Morris Jobke <hey@morrisjobke.de>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
if(php_sapi_name() !== 'cli') {
print('Only via CLI, please.');
exit(1);
diff --git a/apps/user_ldap/tests/wizard.php b/apps/user_ldap/tests/wizard.php
index 525364390bc..7b046187831 100644
--- a/apps/user_ldap/tests/wizard.php
+++ b/apps/user_ldap/tests/wizard.php
@@ -3,6 +3,7 @@
* @author Arthur Schiwon <blizzz@owncloud.com>
* @author Joas Schilling <nickvergessen@owncloud.com>
* @author Morris Jobke <hey@morrisjobke.de>
+ * @author Viktor Szépe <viktor@szepe.net>
*
* @copyright Copyright (c) 2015, ownCloud, Inc.
* @license AGPL-3.0