summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/tests/keymanager.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_encryption/tests/keymanager.php')
-rw-r--r--apps/files_encryption/tests/keymanager.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/apps/files_encryption/tests/keymanager.php b/apps/files_encryption/tests/keymanager.php
index 58a57ee5af4..6f32c50743c 100644
--- a/apps/files_encryption/tests/keymanager.php
+++ b/apps/files_encryption/tests/keymanager.php
@@ -137,6 +137,17 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase {
}
/**
+ * @small
+ */
+ function testGetFilenameFromShareKey() {
+ $this->assertEquals("file",
+ \TestProtectedKeymanagerMethods::testGetFilenameFromShareKey("file.user.shareKey"));
+ $this->assertEquals("file.name.with.dots",
+ \TestProtectedKeymanagerMethods::testGetFilenameFromShareKey("file.name.with.dots.user.shareKey"));
+ $this->assertFalse(\TestProtectedKeymanagerMethods::testGetFilenameFromShareKey("file.txt"));
+ }
+
+ /**
* @medium
*/
function testSetFileKey() {
@@ -234,3 +245,12 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase {
\OC_FileProxy::$enabled = $proxyStatus;
}
}
+
+/**
+ * dummy class to access protected methods of \OCA\Encryption\Keymanager for testing
+ */
+class TestProtectedKeymanagerMethods extends \OCA\Encryption\Keymanager {
+ public static function testGetFilenameFromShareKey($sharekey) {
+ return self::getFilenameFromShareKey($sharekey);
+ }
+} \ No newline at end of file