} else {
\OC_Log::write(
'Encryption library',
- 'No share key found for user "' . $user . '" for file "' . $pathOld . '"',
+ 'No share key found for user "' . $user . '" for file "' . $fileName . '"',
\OC_Log::WARN
);
}
public static function tearDownAfterClass() {
// cleanup test user
\OC_User::deleteUser(\Test_Encryption_Crypt::TEST_ENCRYPTION_CRYPT_USER1);
+
+ \OC_Hook::clear();
+ \OC_FileProxy::clearProxies();
+
+ // Delete keys in /data/
+ $view = new \OC\Files\View('/');
+ $view->rmdir('public-keys');
+ $view->rmdir('owncloud_private_key');
}
/**
const TEST_ENCRYPTION_HELPER_USER1 = "test-helper-user1";
const TEST_ENCRYPTION_HELPER_USER2 = "test-helper-user2";
- public static function setUpBeforeClass() {
+ public function setUp() {
// 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() {
+ public function tearDown() {
// cleanup test user
\OC_User::deleteUser(\Test_Encryption_Helper::TEST_ENCRYPTION_HELPER_USER1);
\OC_User::deleteUser(\Test_Encryption_Helper::TEST_ENCRYPTION_HELPER_USER2);
+ }
+
+ public static function tearDownAfterClass() {
+
\OC_Hook::clear();
\OC_FileProxy::clearProxies();
+
+ // Delete keys in /data/
+ $view = new \OC\Files\View('/');
+ $view->rmdir('public-keys');
+ $view->rmdir('owncloud_private_key');
}
/**
$result
);
}
-
- // clean up
- $rootView->unlink($baseDir);
- \Test_Encryption_Util::logoutHelper();
- \OC_User::deleteUser($userName);
}
}
// cleanup test user
\OC_User::deleteUser(\Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER1);
\OC_User::deleteUser(\Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER2);
+
+ \OC_Hook::clear();
+ \OC_FileProxy::clearProxies();
+
+ // Delete keys in /data/
+ $view = new \OC\Files\View('/');
+ $view->rmdir('public-keys');
+ $view->rmdir('owncloud_private_key');
}
function testDisableHook() {
if (self::$stateFilesTrashbin) {
OC_App::enable('files_trashbin');
}
+
+ \OC_Hook::clear();
+ \OC_FileProxy::clearProxies();
+
+ // Delete keys in /data/
+ $view = new \OC\Files\View('/');
+ $view->rmdir('public-keys');
+ $view->rmdir('owncloud_private_key');
}
/**
public static function tearDownAfterClass() {
// cleanup test user
\OC_User::deleteUser(\Test_Encryption_Proxy::TEST_ENCRYPTION_PROXY_USER1);
+
+ \OC_Hook::clear();
+ \OC_FileProxy::clearProxies();
+
+ // Delete keys in /data/
+ $view = new \OC\Files\View('/');
+ $view->rmdir('public-keys');
+ $view->rmdir('owncloud_private_key');
}
/**
\OC_User::deleteUser(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2);
\OC_User::deleteUser(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3);
\OC_User::deleteUser(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER4);
+
+ \OC_Hook::clear();
+ \OC_FileProxy::clearProxies();
+
+ // Delete keys in /data/
+ $view = new \OC\Files\View('/');
+ $view->rmdir('public-keys');
+ $view->rmdir('owncloud_private_key');
}
public static function tearDownAfterClass() {
// cleanup test user
\OC_User::deleteUser(\Test_Encryption_Stream::TEST_ENCRYPTION_STREAM_USER1);
+
+ \OC_Hook::clear();
+ \OC_FileProxy::clearProxies();
+
+ // Delete keys in /data/
+ $view = new \OC\Files\View('/');
+ $view->rmdir('public-keys');
+ $view->rmdir('owncloud_private_key');
}
function testStreamOptions() {
public static function tearDownAfterClass() {
// cleanup test user
\OC_User::deleteUser(\Test_Encryption_Trashbin::TEST_ENCRYPTION_TRASHBIN_USER1);
+
+ \OC_Hook::clear();
+ \OC_FileProxy::clearProxies();
+
+ // Delete keys in /data/
+ $view = new \OC\Files\View('/');
+ $view->rmdir('public-keys');
+ $view->rmdir('owncloud_private_key');
}
/**
\OC_User::deleteUser(\Test_Encryption_Util::TEST_ENCRYPTION_UTIL_USER1);
\OC_User::deleteUser(\Test_Encryption_Util::TEST_ENCRYPTION_UTIL_USER2);
\OC_User::deleteUser(\Test_Encryption_Util::TEST_ENCRYPTION_UTIL_LEGACY_USER);
+
//cleanup groups
\OC_Group::deleteGroup(self::TEST_ENCRYPTION_UTIL_GROUP1);
\OC_Group::deleteGroup(self::TEST_ENCRYPTION_UTIL_GROUP2);
+
+ \OC_Hook::clear();
+ \OC_FileProxy::clearProxies();
+
+ // Delete keys in /data/
+ $view = new \OC\Files\View('/');
+ $view->rmdir('public-keys');
+ $view->rmdir('owncloud_private_key');
}
public static function setupHooks() {
public static function tearDownAfterClass() {
// cleanup test user
\OC_User::deleteUser(\Test_Encryption_Webdav::TEST_ENCRYPTION_WEBDAV_USER1);
+
+ \OC_Hook::clear();
+ \OC_FileProxy::clearProxies();
+
+ // Delete keys in /data/
+ $view = new \OC\Files\View('/');
+ $view->rmdir('public-keys');
+ $view->rmdir('owncloud_private_key');
}
/**
const TEST_FILES_SHARING_API_GROUP1 = "test-share-group1";
- public $stateFilesEncryption;
+ public static $stateFilesEncryption;
public $filename;
public $data;
/**
public $subfolder;
public static function setUpBeforeClass() {
+
+ // remember files_encryption state
+ self::$stateFilesEncryption = \OC_App::isEnabled('files_encryption');
+
+ //we don't want to tests with app files_encryption enabled
+ \OC_App::disable('files_encryption');
+
// reset backend
\OC_User::clearBackends();
\OC_User::useBackend('database');
function setUp() {
+ $this->assertFalse(\OC_App::isEnabled('files_encryption'));
+
//login as user1
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
$this->data = 'foobar';
$this->view = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files');
- // remember files_encryption state
- $this->stateFilesEncryption = \OC_App::isEnabled('files_encryption');
-
- //we don't want to tests with app files_encryption enabled
- \OC_App::disable('files_encryption');
-
-
- $this->assertTrue(!\OC_App::isEnabled('files_encryption'));
}
function tearDown() {
- // reset app files_encryption
- if ($this->stateFilesEncryption) {
- \OC_App::enable('files_encryption');
- } else {
- \OC_App::disable('files_encryption');
- }
-
$query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share`');
$query->execute();
}
// delete group
\OC_Group::deleteGroup(self::TEST_FILES_SHARING_API_GROUP1);
+
+ // reset app files_encryption
+ if (self::$stateFilesEncryption) {
+ \OC_App::enable('files_encryption');
+ } else {
+ \OC_App::disable('files_encryption');
+ }
}
/**