summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-01-27 13:42:39 +0100
committerVincent Petry <pvince81@owncloud.com>2015-01-27 13:44:05 +0100
commitc4b02176dcf7299cf6d9d1bc8db66db79d14e2e8 (patch)
treeb02ee706cf579f4a2e2b02686afae993bdf7c2b8 /apps/files_external
parent956de27e947b9f3697411ce365595640d5620851 (diff)
downloadnextcloud-server-c4b02176dcf7299cf6d9d1bc8db66db79d14e2e8.tar.gz
nextcloud-server-c4b02176dcf7299cf6d9d1bc8db66db79d14e2e8.zip
Fix mount config unit test failures
Because setStorageId now instantiates storages, they might throw exceptions if arguments are missing. This fixes the unit test to not throw exceptions and have their default config arguments set.
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/tests/mountconfig.php36
1 files changed, 29 insertions, 7 deletions
diff --git a/apps/files_external/tests/mountconfig.php b/apps/files_external/tests/mountconfig.php
index 342f020d3a9..24e32390a98 100644
--- a/apps/files_external/tests/mountconfig.php
+++ b/apps/files_external/tests/mountconfig.php
@@ -184,7 +184,13 @@ class Test_Mount_Config extends \Test\TestCase {
$applicable = 'all';
$isPersonal = false;
- $this->assertEquals(true, OC_Mount_Config::addMountPoint('/ext', '\OC\Files\Storage\SFTP', array(), $mountType, $applicable, $isPersonal));
+ $storageOptions = array(
+ 'host' => 'localhost',
+ 'user' => 'testuser',
+ 'password' => '12345',
+ );
+
+ $this->assertEquals(true, OC_Mount_Config::addMountPoint('/ext', '\OC\Files\Storage\SFTP', $storageOptions, $mountType, $applicable, $isPersonal));
$config = $this->readGlobalConfig();
$this->assertEquals(1, count($config));
@@ -205,7 +211,13 @@ class Test_Mount_Config extends \Test\TestCase {
$applicable = self::TEST_USER1;
$isPersonal = true;
- $this->assertEquals(true, OC_Mount_Config::addMountPoint('/ext', '\OC\Files\Storage\SFTP', array(), $mountType, $applicable, $isPersonal));
+ $storageOptions = array(
+ 'host' => 'localhost',
+ 'user' => 'testuser',
+ 'password' => '12345',
+ );
+
+ $this->assertEquals(true, OC_Mount_Config::addMountPoint('/ext', '\OC\Files\Storage\SFTP', $storageOptions, $mountType, $applicable, $isPersonal));
$config = $this->readUserConfig();
$this->assertEquals(1, count($config));
@@ -236,8 +248,14 @@ class Test_Mount_Config extends \Test\TestCase {
implode(',', array_keys($this->allBackends))
);
+ $storageOptions = array(
+ 'host' => 'localhost',
+ 'user' => 'testuser',
+ 'password' => '12345',
+ );
+
// non-local but forbidden
- $this->assertFalse(OC_Mount_Config::addMountPoint('/ext', '\OC\Files\Storage\SFTP', array(), $mountType, $applicable, $isPersonal));
+ $this->assertFalse(OC_Mount_Config::addMountPoint('/ext', '\OC\Files\Storage\SFTP', $storageOptions, $mountType, $applicable, $isPersonal));
$this->assertFalse(file_exists($this->userHome . '/mount.json'));
}
@@ -629,7 +647,8 @@ class Test_Mount_Config extends \Test\TestCase {
'host' => 'someost',
'user' => 'someuser',
'password' => 'somepassword',
- 'root' => 'someroot'
+ 'root' => 'someroot',
+ 'share' => '',
);
// add mount point as "test" user
@@ -872,7 +891,8 @@ class Test_Mount_Config extends \Test\TestCase {
'host' => 'somehost',
'user' => 'someuser',
'password' => 'somepassword',
- 'root' => 'someroot'
+ 'root' => 'someroot',
+ 'share' => '',
);
// Add mount points
@@ -908,7 +928,8 @@ class Test_Mount_Config extends \Test\TestCase {
'host' => 'somehost',
'user' => 'someuser',
'password' => 'somepassword',
- 'root' => 'someroot'
+ 'root' => 'someroot',
+ 'share' => '',
);
$this->assertTrue(
@@ -954,7 +975,8 @@ class Test_Mount_Config extends \Test\TestCase {
'host' => 'somehost',
'user' => 'someuser',
'password' => 'somepassword',
- 'root' => 'someroot'
+ 'root' => 'someroot',
+ 'share' => '',
);
// Create personal mount point