summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2015-06-03 11:12:44 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2015-06-03 11:59:06 +0200
commit7eb2b31e34bf89a2c0fbf8c6d49aa1eed5899681 (patch)
tree49f844cd946b36b5f3d471da08f98eb4c9a0fdaf /tests
parent410a836702c363cfeb0c7a83dce0d6fcca0c5d7e (diff)
downloadnextcloud-server-7eb2b31e34bf89a2c0fbf8c6d49aa1eed5899681.tar.gz
nextcloud-server-7eb2b31e34bf89a2c0fbf8c6d49aa1eed5899681.zip
make sure that we always use the correct owner for both source and target
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/encryption/keys/storage.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/lib/encryption/keys/storage.php b/tests/lib/encryption/keys/storage.php
index 45cd272cca0..f64e61cd1df 100644
--- a/tests/lib/encryption/keys/storage.php
+++ b/tests/lib/encryption/keys/storage.php
@@ -361,7 +361,46 @@ class StorageTest extends TestCase {
array('/user1/files/source.txt', '/user1/files/target.txt', true, false,
'/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'),
+ array('/user2/files/source.txt', '/user1/files/target.txt', false, false,
+ '/user2/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'),
+ array('/user2/files/foo/source.txt', '/user1/files/target.txt', false, false,
+ '/user2/files_encryption/keys/files/foo/source.txt/', '/user1/files_encryption/keys/files/target.txt/'),
+ array('/user2/files/source.txt', '/user1/files/foo/target.txt', false, false,
+ '/user2/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/foo/target.txt/'),
+ array('/user2/files/source.txt', '/user1/files/foo/target.txt', true, true,
+ '/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/foo/target.txt/'),
+ array('/user2/files/source.txt', '/user1/files/target.txt', false, true,
+ '/user2/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/target.txt/'),
+ array('/user2/files/source.txt', '/user1/files/target.txt', true, false,
+ '/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'),
+ );
+ }
+ /**
+ * @dataProvider dataTestGetPathToKeys
+ *
+ * @param string $path
+ * @param boolean $systemWideMountPoint
+ * @param string $expected
+ */
+ public function testGetPathToKeys($path, $systemWideMountPoint, $expected) {
+
+ $this->util->expects($this->any())
+ ->method('getUidAndFilename')
+ ->will($this->returnCallback(array($this, 'getUidAndFilenameCallback')));
+ $this->util->expects($this->any())
+ ->method('isSystemWideMountPoint')
+ ->willReturn($systemWideMountPoint);
+
+ $this->assertSame($expected,
+ \Test_Helper::invokePrivate($this->storage, 'getPathToKeys', [$path])
+ );
+ }
+
+ public function dataTestGetPathToKeys() {
+ return array(
+ array('/user1/files/source.txt', false, '/user1/files_encryption/keys/files/source.txt/'),
+ array('/user1/files/source.txt', true, '/files_encryption/keys/files/source.txt/')
);
}