aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorSam Tuke <samtuke@owncloud.com>2012-08-15 14:01:43 +0100
committerSam Tuke <samtuke@owncloud.com>2012-08-15 14:01:43 +0100
commitea236e83d73067a8df1ee694011dca979ca60507 (patch)
treedfe3c8814870a5e52bf9d3dba9fdb34c80acce8b /apps
parentd039f11905658f2642d84f4054abde0c3b920ea8 (diff)
downloadnextcloud-server-ea236e83d73067a8df1ee694011dca979ca60507.tar.gz
nextcloud-server-ea236e83d73067a8df1ee694011dca979ca60507.zip
added first version of keymanager PHPUnit test files
Diffstat (limited to 'apps')
-rw-r--r--apps/files_encryption/tests/keymanager.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/apps/files_encryption/tests/keymanager.php b/apps/files_encryption/tests/keymanager.php
new file mode 100644
index 00000000000..e2cc51a223c
--- /dev/null
+++ b/apps/files_encryption/tests/keymanager.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Copyright (c) 2012 Sam Tuke <samtuke@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OCA_Encryption;
+
+require_once "PHPUnit/Framework/TestCase.php";
+require_once realpath( dirname(__FILE__).'/../../../lib/base.php' );
+
+class Test_Keymanager extends \PHPUnit_Framework_TestCase {
+
+ function setUp() {
+
+ // set content for encrypting / decrypting in tests
+ $this->user = 'admin';
+ $this->view = new \OC_FilesystemView( '' );
+
+ // Disable encryption proxy to prevent recursive calls
+ \OC_FileProxy::$enabled = false;
+
+ }
+
+ function tearDown(){
+
+ \OC_FileProxy::$enabled = false;
+
+ }
+
+ function testGetPrivateKey() {
+
+ $key = Keymanager::getPrivateKey( $this->user, $this->view );
+
+ $this->assertEquals( 2302, strlen( $key ) );
+
+ $this->assertTrue( substr( $key, 27 ) == '-----BEGIN PRIVATE KEY-----' );
+
+ }
+
+}