diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-04-09 17:52:24 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-04-23 12:54:25 +0200 |
commit | a86d97295e4e0e1560bcd4cce4bde21aa60a2486 (patch) | |
tree | c1a73dd7a985e8e09beeaa10cbf7631ff866b1d6 /apps/files_encryption/tests/hooks.php | |
parent | 4c840cb61d560ae567e3e9aaa7bd411cac917e48 (diff) | |
download | nextcloud-server-a86d97295e4e0e1560bcd4cce4bde21aa60a2486.tar.gz nextcloud-server-a86d97295e4e0e1560bcd4cce4bde21aa60a2486.zip |
fix encryption tests after the removal of the shared folder
Diffstat (limited to 'apps/files_encryption/tests/hooks.php')
-rw-r--r-- | apps/files_encryption/tests/hooks.php | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/apps/files_encryption/tests/hooks.php b/apps/files_encryption/tests/hooks.php index d0e4b5f732e..047084ca2c1 100644 --- a/apps/files_encryption/tests/hooks.php +++ b/apps/files_encryption/tests/hooks.php @@ -219,18 +219,20 @@ class Test_Encryption_Hooks extends \PHPUnit_Framework_TestCase { \Test_Encryption_Util::loginHelper(\Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER2); \OC_User::setUserId(\Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER2); - // user2 has a local file with the same name + // user2 update the shared file $this->user2View->file_put_contents($this->filename, $this->data); - // check if all keys are generated - $this->assertTrue($this->rootView->file_exists( + // keys should be stored at user1s dir, not in user2s + $this->assertFalse($this->rootView->file_exists( self::TEST_ENCRYPTION_HOOKS_USER2 . '/files_encryption/share-keys/' . $this->filename . '.' . \Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER2 . '.shareKey')); - $this->assertTrue($this->rootView->file_exists( + $this->assertFalse($this->rootView->file_exists( self::TEST_ENCRYPTION_HOOKS_USER2 . '/files_encryption/keyfiles/' . $this->filename . '.key')); // delete the Shared file from user1 in data/user2/files/Shared - $this->user2View->unlink('/Shared/' . $this->filename); + $result = $this->user2View->unlink($this->filename); + + $this->assertTrue($result); // now keys from user1s home should be gone $this->assertFalse($this->rootView->file_exists( @@ -242,26 +244,12 @@ class Test_Encryption_Hooks extends \PHPUnit_Framework_TestCase { $this->assertFalse($this->rootView->file_exists( self::TEST_ENCRYPTION_HOOKS_USER1 . '/files_encryption/keyfiles/' . $this->filename . '.key')); - // but user2 keys should still exist - $this->assertTrue($this->rootView->file_exists( - self::TEST_ENCRYPTION_HOOKS_USER2 . '/files_encryption/share-keys/' - . $this->filename . '.' . \Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER2 . '.shareKey')); - $this->assertTrue($this->rootView->file_exists( - self::TEST_ENCRYPTION_HOOKS_USER2 . '/files_encryption/keyfiles/' . $this->filename . '.key')); - // cleanup - $this->user2View->unlink($this->filename); - \Test_Encryption_Util::logoutHelper(); \Test_Encryption_Util::loginHelper(\Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER1); \OC_User::setUserId(\Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER1); - // unshare the file - \OCP\Share::unshare('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_ENCRYPTION_HOOKS_USER2); - - $this->user1View->unlink($this->filename); - if ($stateFilesTrashbin) { OC_App::enable('files_trashbin'); } |