summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2015-03-27 11:46:07 +0100
committerBjoern Schiessle <schiessle@owncloud.com>2015-03-27 11:51:50 +0100
commitc6be1ba8d35ceb398fdbd0bd7b9e4491119092a0 (patch)
tree8d469a1420dbf643176969d26af7077ead65e80a /tests/lib
parent7e73b255335a73128ece5f495a48533e49a79226 (diff)
downloadnextcloud-server-c6be1ba8d35ceb398fdbd0bd7b9e4491119092a0.tar.gz
nextcloud-server-c6be1ba8d35ceb398fdbd0bd7b9e4491119092a0.zip
fix check if a file is excluded from encryption or not
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/encryption/utiltest.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/lib/encryption/utiltest.php b/tests/lib/encryption/utiltest.php
index 00a9ab9c578..672f9ff5e97 100644
--- a/tests/lib/encryption/utiltest.php
+++ b/tests/lib/encryption/utiltest.php
@@ -98,4 +98,39 @@ class UtilTest extends TestCase {
$u->createHeader($header, $em);
}
+ /**
+ * @dataProvider providePathsForTestIsExcluded
+ */
+ public function testIsEcluded($path, $expected) {
+ $this->userManager
+ ->expects($this->any())
+ ->method('userExists')
+ ->will($this->returnCallback(array($this, 'isExcludedCallback')));
+
+ $u = new Util($this->view, $this->userManager);
+
+ $this->assertSame($expected,
+ $u->isExcluded($path)
+ );
+ }
+
+ public function providePathsForTestIsExcluded() {
+ return array(
+ array('files_encryption/foo.txt', true),
+ array('test/foo.txt', false),
+ array('/user1/files_encryption/foo.txt', true),
+ array('/user1/files/foo.txt', false),
+
+ );
+ }
+
+ public function isExcludedCallback() {
+ $args = func_get_args();
+ if ($args[0] === 'user1') {
+ return true;
+ }
+
+ return false;
+ }
+
}