diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-05-22 15:43:42 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-06-02 13:15:11 +0200 |
commit | b16b17f920f0fffcf2e97762b3cd7297d6f8c43c (patch) | |
tree | 42c1c2bba60b51f210eb7c78ab3b293f0fd8fb5d /apps/files_encryption/tests | |
parent | 790c0e8e7ccc44fc859cfa5b97ef2d8aa1df87d7 (diff) | |
download | nextcloud-server-b16b17f920f0fffcf2e97762b3cd7297d6f8c43c.tar.gz nextcloud-server-b16b17f920f0fffcf2e97762b3cd7297d6f8c43c.zip |
ceanup encryption code, improved return codes
Diffstat (limited to 'apps/files_encryption/tests')
-rw-r--r-- | apps/files_encryption/tests/helper.php | 9 | ||||
-rwxr-xr-x | apps/files_encryption/tests/util.php | 12 |
2 files changed, 8 insertions, 13 deletions
diff --git a/apps/files_encryption/tests/helper.php b/apps/files_encryption/tests/helper.php index 4b46e976b81..582d8149a8a 100644 --- a/apps/files_encryption/tests/helper.php +++ b/apps/files_encryption/tests/helper.php @@ -18,15 +18,20 @@ use OCA\Encryption; class Test_Encryption_Helper extends \PHPUnit_Framework_TestCase { const TEST_ENCRYPTION_HELPER_USER1 = "test-helper-user1"; + const TEST_ENCRYPTION_HELPER_USER2 = "test-helper-user2"; public static function setUpBeforeClass() { // create test user + \Test_Encryption_Util::loginHelper(\Test_Encryption_Helper::TEST_ENCRYPTION_HELPER_USER2, true); \Test_Encryption_Util::loginHelper(\Test_Encryption_Helper::TEST_ENCRYPTION_HELPER_USER1, true); } public static function tearDownAfterClass() { // cleanup test user \OC_User::deleteUser(\Test_Encryption_Helper::TEST_ENCRYPTION_HELPER_USER1); + \OC_User::deleteUser(\Test_Encryption_Helper::TEST_ENCRYPTION_HELPER_USER2); + \OC_Hook::clear(); + \OC_FileProxy::clearProxies(); } /** @@ -81,9 +86,11 @@ class Test_Encryption_Helper extends \PHPUnit_Framework_TestCase { $path1 = "/" . self::TEST_ENCRYPTION_HELPER_USER1 . "/files/foo/bar.txt"; $path2 = "/" . self::TEST_ENCRYPTION_HELPER_USER1 . "/cache/foo/bar.txt"; - $path3 = "/" . self::TEST_ENCRYPTION_HELPER_USER1 . "/thumbnails/foo"; + $path3 = "/" . self::TEST_ENCRYPTION_HELPER_USER2 . "/thumbnails/foo"; $path4 ="/" . "/" . self::TEST_ENCRYPTION_HELPER_USER1; + \Test_Encryption_Util::loginHelper(self::TEST_ENCRYPTION_HELPER_USER1); + // if we are logged-in every path should return the currently logged-in user $this->assertEquals(self::TEST_ENCRYPTION_HELPER_USER1, Encryption\Helper::getUser($path3)); diff --git a/apps/files_encryption/tests/util.php b/apps/files_encryption/tests/util.php index a4dcc5cc8bd..2b873bb308d 100755 --- a/apps/files_encryption/tests/util.php +++ b/apps/files_encryption/tests/util.php @@ -306,18 +306,6 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase { $this->view->unlink($this->userId . '/files/' . $filename); } - /** - * @medium - */ - function testIsSharedPath() { - $sharedPath = '/user1/files/Shared/test'; - $path = '/user1/files/test'; - - $this->assertTrue($this->util->isSharedPath($sharedPath)); - - $this->assertFalse($this->util->isSharedPath($path)); - } - function testEncryptAll() { $filename = "/encryptAll" . uniqid() . ".txt"; |