Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@karoshi.org.uk>2014-07-15 21:39:09 +0400
committerJörn Friedrich Dreyer <jfd@butonic.de>2014-08-08 17:52:22 +0400
commit6b38c1de6864eacdcb4fdf9bdc6a73a6bf7feb98 (patch)
treef1daff0ffe3afff0e0dc55e5f7dcdc27f506129b /apps
parent2c192a1b76a3526e9456e3f579dc5ef31f1208f2 (diff)
Add unit test for multi-user configuration loading
Diffstat (limited to 'apps')
-rw-r--r--apps/files_external/tests/mountconfig.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/apps/files_external/tests/mountconfig.php b/apps/files_external/tests/mountconfig.php
index 4df4ff34ea5..8e21f7e7d80 100644
--- a/apps/files_external/tests/mountconfig.php
+++ b/apps/files_external/tests/mountconfig.php
@@ -616,4 +616,41 @@ class Test_Mount_Config extends \PHPUnit_Framework_TestCase {
$this->assertEquals('ext', $config[1]['mountpoint']);
$this->assertEquals($options2, $config[1]['options']);
}
+
+ /*
+ * Test for correct personal configuration loading in file sharing scenarios
+ */
+ public function testMultiUserPersonalConfigLoading() {
+ $mountConfig = array(
+ 'host' => 'somehost',
+ 'user' => 'someuser',
+ 'password' => 'somepassword',
+ 'root' => 'someroot'
+ );
+
+ // Create personal mount point
+ $this->assertTrue(
+ OC_Mount_Config::addMountPoint(
+ '/ext',
+ '\OC\Files\Storage\SMB',
+ $mountConfig,
+ OC_Mount_Config::MOUNT_TYPE_USER,
+ self::TEST_USER1,
+ true
+ )
+ );
+
+ // Ensure other user can read mount points
+ \OC_User::setUserId(self::TEST_USER2);
+ $mountPointsMe = OC_Mount_Config::getAbsoluteMountPoints(self::TEST_USER2);
+ $mountPointsOther = OC_Mount_Config::getAbsoluteMountPoints(self::TEST_USER1);
+
+ $this->assertEquals(0, count($mountPointsMe));
+ $this->assertEquals(1, count($mountPointsOther));
+ $this->assertTrue(isset($mountPointsOther['/'.self::TEST_USER1.'/files/ext']));
+ $this->assertEquals('\OC\Files\Storage\SMB',
+ $mountPointsOther['/'.self::TEST_USER1.'/files/ext']['class']);
+ $this->assertEquals($mountConfig,
+ $mountPointsOther['/'.self::TEST_USER1.'/files/ext']['options']);
+ }
}