summaryrefslogtreecommitdiffstats
path: root/apps/encryption
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-10-15 16:20:54 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-10-16 21:41:51 +0200
commitd636bce8a478f7077589c56eba5d38d701e105b0 (patch)
tree93d227e08a0699999957147d083f5f278c017930 /apps/encryption
parente4364426e237b58b7769d2a289a2e63d246b2e9c (diff)
downloadnextcloud-server-d636bce8a478f7077589c56eba5d38d701e105b0.tar.gz
nextcloud-server-d636bce8a478f7077589c56eba5d38d701e105b0.zip
fix encryption migration test
Diffstat (limited to 'apps/encryption')
-rw-r--r--apps/encryption/tests/lib/MigrationTest.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/encryption/tests/lib/MigrationTest.php b/apps/encryption/tests/lib/MigrationTest.php
index d701aaff0d3..be37020660c 100644
--- a/apps/encryption/tests/lib/MigrationTest.php
+++ b/apps/encryption/tests/lib/MigrationTest.php
@@ -62,6 +62,8 @@ class MigrationTest extends \Test\TestCase {
}
protected function createDummyShareKeys($uid) {
+ $this->loginAsUser($uid);
+
$this->view->mkdir($uid . '/files_encryption/keys/folder1/folder2/folder3/file3');
$this->view->mkdir($uid . '/files_encryption/keys/folder1/folder2/file2');
$this->view->mkdir($uid . '/files_encryption/keys/folder1/file.1');
@@ -87,6 +89,8 @@ class MigrationTest extends \Test\TestCase {
}
protected function createDummyUserKeys($uid) {
+ $this->loginAsUser($uid);
+
$this->view->mkdir($uid . '/files_encryption/');
$this->view->mkdir('/files_encryption/public_keys');
$this->view->file_put_contents($uid . '/files_encryption/' . $uid . '.privateKey', 'privateKey');
@@ -94,6 +98,8 @@ class MigrationTest extends \Test\TestCase {
}
protected function createDummyFileKeys($uid) {
+ $this->loginAsUser($uid);
+
$this->view->mkdir($uid . '/files_encryption/keys/folder1/folder2/folder3/file3');
$this->view->mkdir($uid . '/files_encryption/keys/folder1/folder2/file2');
$this->view->mkdir($uid . '/files_encryption/keys/folder1/file.1');
@@ -105,6 +111,8 @@ class MigrationTest extends \Test\TestCase {
}
protected function createDummyFiles($uid) {
+ $this->loginAsUser($uid);
+
$this->view->mkdir($uid . '/files/folder1/folder2/folder3/file3');
$this->view->mkdir($uid . '/files/folder1/folder2/file2');
$this->view->mkdir($uid . '/files/folder1/file.1');
@@ -116,6 +124,8 @@ class MigrationTest extends \Test\TestCase {
}
protected function createDummyFilesInTrash($uid) {
+ $this->loginAsUser($uid);
+
$this->view->mkdir($uid . '/files_trashbin/keys/file1.d5457864');
$this->view->mkdir($uid . '/files_trashbin/keys/folder1.d7437648723/file2');
$this->view->file_put_contents($uid . '/files_trashbin/keys/file1.d5457864/' . self::TEST_ENCRYPTION_MIGRATION_USER1 . '.shareKey' , 'data');
@@ -165,6 +175,7 @@ class MigrationTest extends \Test\TestCase {
$this->createDummySystemWideKeys();
+ /** @var \PHPUnit_Framework_MockObject_MockObject|\OCA\Encryption\Migration $m */
$m = $this->getMockBuilder('OCA\Encryption\Migration')
->setConstructorArgs(
[
@@ -182,21 +193,32 @@ class MigrationTest extends \Test\TestCase {
// even if it runs twice folder should always move only once
$m->reorganizeFolderStructure();
+ $this->loginAsUser(self::TEST_ENCRYPTION_MIGRATION_USER1);
+
$this->assertTrue(
$this->view->file_exists(
self::TEST_ENCRYPTION_MIGRATION_USER1 . '/files_encryption/' .
$this->moduleId . '/' . self::TEST_ENCRYPTION_MIGRATION_USER1 . '.publicKey')
);
+
+ $this->loginAsUser(self::TEST_ENCRYPTION_MIGRATION_USER2);
+
$this->assertTrue(
$this->view->file_exists(
self::TEST_ENCRYPTION_MIGRATION_USER2 . '/files_encryption/' .
$this->moduleId . '/' . self::TEST_ENCRYPTION_MIGRATION_USER2 . '.publicKey')
);
+
+ $this->loginAsUser(self::TEST_ENCRYPTION_MIGRATION_USER3);
+
$this->assertTrue(
$this->view->file_exists(
self::TEST_ENCRYPTION_MIGRATION_USER3 . '/files_encryption/' .
$this->moduleId . '/' . self::TEST_ENCRYPTION_MIGRATION_USER3 . '.publicKey')
);
+
+ $this->loginAsUser(self::TEST_ENCRYPTION_MIGRATION_USER1);
+
$this->assertTrue(
$this->view->file_exists(
'/files_encryption/' . $this->moduleId . '/systemwide_1.publicKey')
@@ -217,6 +239,8 @@ class MigrationTest extends \Test\TestCase {
}
protected function verifyFilesInTrash($uid) {
+ $this->loginAsUser($uid);
+
// share keys
$this->assertTrue(
$this->view->file_exists($uid . '/files_encryption/keys/files_trashbin/file1.d5457864/' . $this->moduleId . '/' . self::TEST_ENCRYPTION_MIGRATION_USER1 . '.shareKey')
@@ -244,6 +268,7 @@ class MigrationTest extends \Test\TestCase {
protected function verifyNewKeyPath($uid) {
// private key
if ($uid !== '') {
+ $this->loginAsUser($uid);
$this->assertTrue($this->view->file_exists($uid . '/files_encryption/' . $this->moduleId . '/'. $uid . '.privateKey'));
}
// file keys