コード例 #1
0
ファイル: util.php プロジェクト: droiter/openwrt-on-android
 protected function setUp()
 {
     parent::setUp();
     // login user
     self::loginHelper(self::TEST_ENCRYPTION_UTIL_USER1);
     \OC_User::setUserId(self::TEST_ENCRYPTION_UTIL_USER1);
     $this->userId = self::TEST_ENCRYPTION_UTIL_USER1;
     $this->pass = self::TEST_ENCRYPTION_UTIL_USER1;
     // set content for encrypting / decrypting in tests
     $this->dataUrl = __DIR__ . '/../lib/crypt.php';
     $this->dataShort = 'hats';
     $this->dataLong = file_get_contents(__DIR__ . '/../lib/crypt.php');
     $this->legacyData = __DIR__ . '/legacy-text.txt';
     $this->legacyEncryptedData = __DIR__ . '/legacy-encrypted-text.txt';
     $this->legacyEncryptedDataKey = __DIR__ . '/encryption.key';
     $this->legacyKey = "30943623843030686906";
     $keypair = Encryption\Crypt::createKeypair();
     $this->genPublicKey = $keypair['publicKey'];
     $this->genPrivateKey = $keypair['privateKey'];
     $this->publicKeyDir = '/' . 'public-keys';
     $this->encryptionDir = '/' . $this->userId . '/' . 'files_encryption';
     $this->keyfilesPath = $this->encryptionDir . '/' . 'keyfiles';
     $this->publicKeyPath = $this->publicKeyDir . '/' . $this->userId . '.public.key';
     // e.g. data/public-keys/admin.public.key
     $this->privateKeyPath = $this->encryptionDir . '/' . $this->userId . '.private.key';
     // e.g. data/admin/admin.private.key
     $this->view = new \OC\Files\View('/');
     $this->util = new Encryption\Util($this->view, $this->userId);
     // remember files_trashbin state
     $this->stateFilesTrashbin = OC_App::isEnabled('files_trashbin');
     // we don't want to tests with app files_trashbin enabled
     \OC_App::disable('files_trashbin');
 }
コード例 #2
0
ファイル: hooks.php プロジェクト: droiter/openwrt-on-android
 protected function setUp()
 {
     parent::setUp();
     // set user id
     self::loginHelper(\Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER1);
     \OC_User::setUserId(\Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER1);
     // init filesystem view
     $this->user1View = new \OC\Files\View('/' . \Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER1 . '/files');
     $this->user2View = new \OC\Files\View('/' . \Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER2 . '/files');
     $this->rootView = new \OC\Files\View('/');
     // init short data
     $this->data = 'hats';
     $this->filename = 'enc_hooks_tests-' . $this->getUniqueID() . '.txt';
     $this->folder = 'enc_hooks_tests_folder-' . $this->getUniqueID();
 }
コード例 #3
0
ファイル: proxy.php プロジェクト: droiter/openwrt-on-android
 protected function setUp()
 {
     parent::setUp();
     // set user id
     \OC_User::setUserId(\Test_Encryption_Proxy::TEST_ENCRYPTION_PROXY_USER1);
     $this->userId = \Test_Encryption_Proxy::TEST_ENCRYPTION_PROXY_USER1;
     $this->pass = \Test_Encryption_Proxy::TEST_ENCRYPTION_PROXY_USER1;
     // init filesystem view
     $this->view = new \OC\Files\View('/' . \Test_Encryption_Proxy::TEST_ENCRYPTION_PROXY_USER1 . '/files');
     $this->rootView = new \OC\Files\View('/' . \Test_Encryption_Proxy::TEST_ENCRYPTION_PROXY_USER1);
     // init short data
     $this->data = 'hats';
     $this->dataLong = file_get_contents(__DIR__ . '/../lib/crypt.php');
     $this->filename = 'enc_proxy_tests-' . $this->getUniqueID() . '.txt';
 }
コード例 #4
0
ファイル: share.php プロジェクト: droiter/openwrt-on-android
 protected function setUp()
 {
     parent::setUp();
     $this->dataShort = 'hats';
     $this->view = new \OC\Files\View('/');
     $this->folder1 = '/folder1';
     $this->subfolder = '/subfolder1';
     $this->subsubfolder = '/subsubfolder1';
     $this->filename = 'share-tmp.test';
     // remember files_trashbin state
     $this->stateFilesTrashbin = OC_App::isEnabled('files_trashbin');
     // we don't want to tests with app files_trashbin enabled
     \OC_App::disable('files_trashbin');
     // login as first user
     self::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1);
 }
コード例 #5
0
ファイル: stream.php プロジェクト: droiter/openwrt-on-android
 protected function setUp()
 {
     parent::setUp();
     // set user id
     \OC_User::setUserId(\Test_Encryption_Stream::TEST_ENCRYPTION_STREAM_USER1);
     $this->userId = \Test_Encryption_Stream::TEST_ENCRYPTION_STREAM_USER1;
     $this->pass = \Test_Encryption_Stream::TEST_ENCRYPTION_STREAM_USER1;
     // init filesystem view
     $this->view = new \OC\Files\View('/');
     // init short data
     $this->dataShort = 'hats';
     // remember files_trashbin state
     $this->stateFilesTrashbin = OC_App::isEnabled('files_trashbin');
     // we don't want to tests with app files_trashbin enabled
     \OC_App::disable('files_trashbin');
 }
コード例 #6
0
 protected function setUp()
 {
     parent::setUp();
     // set content for encrypting / decrypting in tests
     $this->dataLong = file_get_contents(__DIR__ . '/../lib/crypt.php');
     $this->dataShort = 'hats';
     $this->dataUrl = __DIR__ . '/../lib/crypt.php';
     $this->legacyData = __DIR__ . '/legacy-text.txt';
     $this->legacyEncryptedData = __DIR__ . '/legacy-encrypted-text.txt';
     $this->randomKey = Encryption\Crypt::generateKey();
     $keypair = Encryption\Crypt::createKeypair();
     $this->genPublicKey = $keypair['publicKey'];
     $this->genPrivateKey = $keypair['privateKey'];
     $this->view = new \OC\Files\View('/');
     self::loginHelper(Test_Encryption_Keymanager::TEST_USER);
     $this->userId = \Test_Encryption_Keymanager::TEST_USER;
     $this->pass = \Test_Encryption_Keymanager::TEST_USER;
     $userHome = \OC_User::getHome($this->userId);
     $this->dataDir = str_replace('/' . $this->userId, '', $userHome);
 }
コード例 #7
0
 protected function setUp()
 {
     parent::setUp();
     // set user id
     \OC_User::setUserId(self::TEST_ENCRYPTION_TRASHBIN_USER1);
     $this->userId = self::TEST_ENCRYPTION_TRASHBIN_USER1;
     $this->pass = self::TEST_ENCRYPTION_TRASHBIN_USER1;
     // init filesystem view
     $this->view = new \OC\Files\View('/');
     // init short data
     $this->dataShort = 'hats';
     $this->folder1 = '/folder1';
     $this->subfolder = '/subfolder1';
     $this->subsubfolder = '/subsubfolder1';
     // remember files_trashbin state
     $this->stateFilesTrashbin = OC_App::isEnabled('files_trashbin');
     $this->view->deleteAll('/' . self::TEST_ENCRYPTION_TRASHBIN_USER1 . '/files_trashbin');
     $this->view->deleteAll('/' . self::TEST_ENCRYPTION_TRASHBIN_USER2 . '/files_trashbin');
     // we want to tests with app files_trashbin enabled
     \OC_App::enable('files_trashbin');
 }
コード例 #8
0
ファイル: webdav.php プロジェクト: droiter/openwrt-on-android
 protected function setUp()
 {
     parent::setUp();
     // reset backend
     \OC_User::useBackend('database');
     // set user id
     \OC_User::setUserId(\Test_Encryption_Webdav::TEST_ENCRYPTION_WEBDAV_USER1);
     $this->userId = \Test_Encryption_Webdav::TEST_ENCRYPTION_WEBDAV_USER1;
     $this->pass = \Test_Encryption_Webdav::TEST_ENCRYPTION_WEBDAV_USER1;
     // init filesystem view
     $this->view = new \OC\Files\View('/');
     list($this->storage, ) = $this->view->resolvePath('/');
     // init short data
     $this->dataShort = 'hats';
     // remember files_trashbin state
     $this->stateFilesTrashbin = OC_App::isEnabled('files_trashbin');
     // we don't want to tests with app files_trashbin enabled
     \OC_App::disable('files_trashbin');
     // create test user
     self::loginHelper(\Test_Encryption_Webdav::TEST_ENCRYPTION_WEBDAV_USER1);
 }
コード例 #9
0
ファイル: crypt.php プロジェクト: droiter/openwrt-on-android
 protected function setUp()
 {
     parent::setUp();
     // set user id
     \OC_User::setUserId(\Test_Encryption_Crypt::TEST_ENCRYPTION_CRYPT_USER1);
     $this->userId = \Test_Encryption_Crypt::TEST_ENCRYPTION_CRYPT_USER1;
     $this->pass = \Test_Encryption_Crypt::TEST_ENCRYPTION_CRYPT_USER1;
     // set content for encrypting / decrypting in tests
     $this->dataLong = file_get_contents(__DIR__ . '/../lib/crypt.php');
     $this->dataShort = 'hats';
     $this->dataUrl = __DIR__ . '/../lib/crypt.php';
     $this->legacyData = __DIR__ . '/legacy-text.txt';
     $this->legacyEncryptedData = __DIR__ . '/legacy-encrypted-text.txt';
     $this->legacyEncryptedDataKey = __DIR__ . '/encryption.key';
     $this->randomKey = Encryption\Crypt::generateKey();
     $keypair = Encryption\Crypt::createKeypair();
     $this->genPublicKey = $keypair['publicKey'];
     $this->genPrivateKey = $keypair['privateKey'];
     $this->view = new \OC\Files\View('/');
     // remember files_trashbin state
     $this->stateFilesTrashbin = OC_App::isEnabled('files_trashbin');
     // we don't want to tests with app files_trashbin enabled
     \OC_App::disable('files_trashbin');
 }