summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-05-11 20:32:37 +0200
committerRobin Appelman <icewind@owncloud.com>2012-05-11 20:33:56 +0200
commit736739bbbda2e9930b7bdcf79f43a28fad4d1d5d (patch)
treeb77bc51d0759baeec9e5b3cc2857548a12715d13 /apps/files_encryption
parentd2bd78c41a58320e0f1f6ff6d602371325390747 (diff)
downloadnextcloud-server-736739bbbda2e9930b7bdcf79f43a28fad4d1d5d.tar.gz
nextcloud-server-736739bbbda2e9930b7bdcf79f43a28fad4d1d5d.zip
load remote and public paths from info.xml during upgrade instead of setting them every time
Diffstat (limited to 'apps/files_encryption')
-rw-r--r--apps/files_encryption/tests/proxy.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/apps/files_encryption/tests/proxy.php b/apps/files_encryption/tests/proxy.php
new file mode 100644
index 00000000000..0450de82acb
--- /dev/null
+++ b/apps/files_encryption/tests/proxy.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+class Test_CryptProxy extends UnitTestCase {
+
+ public function setUp(){
+ //set testing key
+ $_SESSION['enckey']=md5(time());
+
+ //clear all proxies and hooks so we can do clean testing
+ OC_FileProxy::clearProxies();
+ OC_Hook::clear('OC_Filesystem');
+
+ //enable only the encryption hook
+ OC_FileProxy::register(new OC_FileProxy_Encryption());
+
+ //set up temporary storage
+ OC_Filesystem::clearMounts();
+ OC_Filesystem::mount('OC_Filestorage_Temporary',array(),'/');
+
+ //set up the users home folder in the temp storage
+ $rootView=new OC_FilesystemView('');
+ $rootView->mkdir('/'.OC_User::getUser());
+ $rootView->mkdir('/'.OC_User::getUser().'/files');
+ }
+
+ public function testSimple(){
+ $file=OC::$SERVERROOT.'/3rdparty/MDB2.php';
+ $original=file_get_contents($file);
+
+ OC_Filesystem::file_put_contents('/file',$original);
+
+ OC_FileProxy::$enabled=false;
+ $stored=OC_Filesystem::file_get_contents('/file');
+ OC_FileProxy::$enabled=true;
+
+ $fromFile=OC_Filesystem::file_get_contents('/file');
+ $this->assertNotEqual($original,$stored);
+ $this->assertEqual($original,$fromFile);
+ }
+}