aboutsummaryrefslogtreecommitdiffstats
path: root/apps/encryption/tests
diff options
context:
space:
mode:
Diffstat (limited to 'apps/encryption/tests')
-rw-r--r--apps/encryption/tests/Command/TestEnableMasterKey.php2
-rw-r--r--apps/encryption/tests/Controller/RecoveryControllerTest.php8
-rw-r--r--apps/encryption/tests/Controller/SettingsControllerTest.php5
-rw-r--r--apps/encryption/tests/Controller/StatusControllerTest.php2
-rw-r--r--apps/encryption/tests/Crypto/CryptTest.php11
-rw-r--r--apps/encryption/tests/Crypto/DecryptAllTest.php2
-rw-r--r--apps/encryption/tests/Crypto/EncryptAllTest.php7
-rw-r--r--apps/encryption/tests/Crypto/EncryptionTest.php6
-rw-r--r--apps/encryption/tests/HookManagerTest.php3
-rw-r--r--apps/encryption/tests/Hooks/UserHooksTest.php4
-rw-r--r--apps/encryption/tests/KeyManagerTest.php11
-rw-r--r--apps/encryption/tests/RecoveryTest.php4
-rw-r--r--apps/encryption/tests/SessionTest.php1
-rw-r--r--apps/encryption/tests/Users/SetupTest.php2
-rw-r--r--apps/encryption/tests/UtilTest.php1
15 files changed, 4 insertions, 65 deletions
diff --git a/apps/encryption/tests/Command/TestEnableMasterKey.php b/apps/encryption/tests/Command/TestEnableMasterKey.php
index f8cbd790adb..b8db72938a5 100644
--- a/apps/encryption/tests/Command/TestEnableMasterKey.php
+++ b/apps/encryption/tests/Command/TestEnableMasterKey.php
@@ -77,7 +77,6 @@ class TestEnableMasterKey extends TestCase {
* @param string $answer
*/
public function testExecute($isAlreadyEnabled, $answer) {
-
$this->util->expects($this->once())->method('isMasterKeyEnabled')
->willReturn($isAlreadyEnabled);
@@ -92,7 +91,6 @@ class TestEnableMasterKey extends TestCase {
} else {
$this->questionHelper->expects($this->once())->method('ask')->willReturn(false);
$this->config->expects($this->never())->method('setAppValue');
-
}
}
diff --git a/apps/encryption/tests/Controller/RecoveryControllerTest.php b/apps/encryption/tests/Controller/RecoveryControllerTest.php
index 5f69f11d2f7..27d67a12dfa 100644
--- a/apps/encryption/tests/Controller/RecoveryControllerTest.php
+++ b/apps/encryption/tests/Controller/RecoveryControllerTest.php
@@ -65,8 +65,6 @@ class RecoveryControllerTest extends TestCase {
* @param $expectedStatus
*/
public function testAdminRecovery($recoveryPassword, $passConfirm, $enableRecovery, $expectedMessage, $expectedStatus) {
-
-
$this->recoveryMock->expects($this->any())
->method('enableAdminRecovery')
->willReturn(true);
@@ -82,8 +80,6 @@ class RecoveryControllerTest extends TestCase {
$this->assertEquals($expectedMessage, $response->getData()['data']['message']);
$this->assertEquals($expectedStatus, $response->getStatus());
-
-
}
public function changeRecoveryPasswordProvider() {
@@ -119,8 +115,6 @@ class RecoveryControllerTest extends TestCase {
$this->assertEquals($expectedMessage, $response->getData()['data']['message']);
$this->assertEquals($expectedStatus, $response->getStatus());
-
-
}
public function userSetRecoveryProvider() {
@@ -150,7 +144,6 @@ class RecoveryControllerTest extends TestCase {
$this->assertEquals($expectedMessage, $response->getData()['data']['message']);
$this->assertEquals($expectedStatus, $response->getStatus());
-
}
protected function setUp(): void {
@@ -183,5 +176,4 @@ class RecoveryControllerTest extends TestCase {
$this->l10nMock,
$this->recoveryMock);
}
-
}
diff --git a/apps/encryption/tests/Controller/SettingsControllerTest.php b/apps/encryption/tests/Controller/SettingsControllerTest.php
index 160c9794613..0cd69c8c1c4 100644
--- a/apps/encryption/tests/Controller/SettingsControllerTest.php
+++ b/apps/encryption/tests/Controller/SettingsControllerTest.php
@@ -76,7 +76,6 @@ class SettingsControllerTest extends TestCase {
private $utilMock;
protected function setUp(): void {
-
parent::setUp();
$this->requestMock = $this->createMock(IRequest::class);
@@ -136,7 +135,6 @@ class SettingsControllerTest extends TestCase {
* test updatePrivateKeyPassword() if wrong new password was entered
*/
public function testUpdatePrivateKeyPasswordWrongNewPassword() {
-
$oldPassword = 'old';
$newPassword = 'new';
@@ -162,7 +160,6 @@ class SettingsControllerTest extends TestCase {
* test updatePrivateKeyPassword() if wrong old password was entered
*/
public function testUpdatePrivateKeyPasswordWrongOldPassword() {
-
$oldPassword = 'old';
$newPassword = 'new';
@@ -189,7 +186,6 @@ class SettingsControllerTest extends TestCase {
* test updatePrivateKeyPassword() with the correct old and new password
*/
public function testUpdatePrivateKeyPassword() {
-
$oldPassword = 'old';
$newPassword = 'new';
@@ -254,5 +250,4 @@ class SettingsControllerTest extends TestCase {
$this->utilMock->expects($this->once())->method('setEncryptHomeStorage')->with($value);
$this->controller->setEncryptHomeStorage($value);
}
-
}
diff --git a/apps/encryption/tests/Controller/StatusControllerTest.php b/apps/encryption/tests/Controller/StatusControllerTest.php
index fe2616f9c54..5028fefbbe0 100644
--- a/apps/encryption/tests/Controller/StatusControllerTest.php
+++ b/apps/encryption/tests/Controller/StatusControllerTest.php
@@ -52,7 +52,6 @@ class StatusControllerTest extends TestCase {
protected $controller;
protected function setUp(): void {
-
parent::setUp();
$this->sessionMock = $this->getMockBuilder(Session::class)
@@ -73,7 +72,6 @@ class StatusControllerTest extends TestCase {
$this->l10nMock,
$this->sessionMock,
$this->encryptionManagerMock);
-
}
/**
diff --git a/apps/encryption/tests/Crypto/CryptTest.php b/apps/encryption/tests/Crypto/CryptTest.php
index dd892616d0f..6f7b0cc2765 100644
--- a/apps/encryption/tests/Crypto/CryptTest.php
+++ b/apps/encryption/tests/Crypto/CryptTest.php
@@ -76,7 +76,6 @@ class CryptTest extends TestCase {
* test getOpenSSLConfig without any additional parameters
*/
public function testGetOpenSSLConfigBasic() {
-
$this->config->expects($this->once())
->method('getSystemValue')
->with($this->equalTo('openssl'), $this->equalTo([]))
@@ -92,7 +91,6 @@ class CryptTest extends TestCase {
* test getOpenSSLConfig with additional parameters defined in config.php
*/
public function testGetOpenSSLConfig() {
-
$this->config->expects($this->once())
->method('getSystemValue')
->with($this->equalTo('openssl'), $this->equalTo([]))
@@ -113,7 +111,6 @@ class CryptTest extends TestCase {
* @dataProvider dataTestGenerateHeader
*/
public function testGenerateHeader($keyFormat, $expected) {
-
$this->config->expects($this->once())
->method('getSystemValue')
->with($this->equalTo('cipher'), $this->equalTo('AES-256-CTR'))
@@ -176,7 +173,6 @@ class CryptTest extends TestCase {
$this->assertSame($expected,
$this->crypt->getCipher()
);
-
}
/**
@@ -199,7 +195,6 @@ class CryptTest extends TestCase {
* test concatIV()
*/
public function testConcatIV() {
-
$result = self::invokePrivate(
$this->crypt,
'concatIV',
@@ -305,7 +300,6 @@ class CryptTest extends TestCase {
* test parseHeader()
*/
public function testParseHeader() {
-
$header= 'HBEGIN:foo:bar:cipher:AES-256-CFB:HEND';
$result = self::invokePrivate($this->crypt, 'parseHeader', [$header]);
@@ -323,7 +317,6 @@ class CryptTest extends TestCase {
* @return string
*/
public function testEncrypt() {
-
$decrypted = 'content';
$password = 'password';
$iv = self::invokePrivate($this->crypt, 'generateIv');
@@ -340,7 +333,6 @@ class CryptTest extends TestCase {
'iv' => $iv,
'encrypted' => $result,
'decrypted' => $decrypted];
-
}
/**
@@ -349,14 +341,12 @@ class CryptTest extends TestCase {
* @depends testEncrypt
*/
public function testDecrypt($data) {
-
$result = self::invokePrivate(
$this->crypt,
'decrypt',
[$data['encrypted'], $data['iv'], $data['password']]);
$this->assertSame($data['decrypted'], $result);
-
}
/**
@@ -461,5 +451,4 @@ class CryptTest extends TestCase {
$this->invokePrivate($this->crypt, 'isValidPrivateKey', ['foo'])
);
}
-
}
diff --git a/apps/encryption/tests/Crypto/DecryptAllTest.php b/apps/encryption/tests/Crypto/DecryptAllTest.php
index be980149145..b4d846bfd5a 100644
--- a/apps/encryption/tests/Crypto/DecryptAllTest.php
+++ b/apps/encryption/tests/Crypto/DecryptAllTest.php
@@ -110,7 +110,6 @@ class DecryptAllTest extends TestCase {
$this->keyManager->expects($this->never())->method('getPrivateKey');
$this->crypt->expects($this->once())->method('decryptPrivateKey')
->with($masterKey, $password, $masterKeyId)->willReturn($unencryptedKey);
-
} else {
$this->keyManager->expects($this->never())->method('getSystemPrivateKey');
$this->keyManager->expects($this->once())->method('getPrivateKey')
@@ -131,5 +130,4 @@ class DecryptAllTest extends TestCase {
['masterKeyId', 'masterKeyId', 'masterKeyId']
];
}
-
}
diff --git a/apps/encryption/tests/Crypto/EncryptAllTest.php b/apps/encryption/tests/Crypto/EncryptAllTest.php
index f5fd3d2287f..3041c27dee7 100644
--- a/apps/encryption/tests/Crypto/EncryptAllTest.php
+++ b/apps/encryption/tests/Crypto/EncryptAllTest.php
@@ -168,7 +168,6 @@ class EncryptAllTest extends TestCase {
$encryptAll->expects($this->at(2))->method('encryptAllUsersFiles')->with();
$encryptAll->encryptAll($this->inputInterface, $this->outputInterface);
-
}
public function testEncryptAllWithMasterKey() {
@@ -198,7 +197,6 @@ class EncryptAllTest extends TestCase {
$encryptAll->expects($this->never())->method('outputPasswords');
$encryptAll->encryptAll($this->inputInterface, $this->outputInterface);
-
}
public function testCreateKeyPairs() {
@@ -280,7 +278,6 @@ class EncryptAllTest extends TestCase {
$encryptAll->expects($this->at(1))->method('encryptUsersFiles')->with('user2');
$this->invokePrivate($encryptAll, 'encryptAllUsersFiles');
-
}
public function testEncryptUsersFiles() {
@@ -339,7 +336,6 @@ class EncryptAllTest extends TestCase {
$progressBar = new ProgressBar($this->outputInterface);
$this->invokePrivate($encryptAll, 'encryptUsersFiles', ['user1', $progressBar, '']);
-
}
public function testGenerateOneTimePassword() {
@@ -364,7 +360,7 @@ class EncryptAllTest extends TestCase {
->willReturn($fileInfo);
- if($isEncrypted) {
+ if ($isEncrypted) {
$this->view->expects($this->never())->method('copy');
$this->view->expects($this->never())->method('rename');
} else {
@@ -383,5 +379,4 @@ class EncryptAllTest extends TestCase {
[false],
];
}
-
}
diff --git a/apps/encryption/tests/Crypto/EncryptionTest.php b/apps/encryption/tests/Crypto/EncryptionTest.php
index 1e4cfad5e30..dee1118a992 100644
--- a/apps/encryption/tests/Crypto/EncryptionTest.php
+++ b/apps/encryption/tests/Crypto/EncryptionTest.php
@@ -118,7 +118,6 @@ class EncryptionTest extends TestCase {
$this->loggerMock,
$this->l10nMock
);
-
}
/**
@@ -200,7 +199,6 @@ class EncryptionTest extends TestCase {
* @dataProvider dataTestBegin
*/
public function testBegin($mode, $header, $legacyCipher, $defaultCipher, $fileKey, $expected) {
-
$this->sessionMock->expects($this->once())
->method('decryptAllModeActivated')
->willReturn(false);
@@ -255,7 +253,6 @@ class EncryptionTest extends TestCase {
* test begin() if decryptAll mode was activated
*/
public function testBeginDecryptAll() {
-
$path = '/user/files/foo.txt';
$recoveryKeyId = 'recoveryKeyId';
$recoveryShareKey = 'recoveryShareKey';
@@ -299,7 +296,6 @@ class EncryptionTest extends TestCase {
* and continue
*/
public function testBeginInitMasterKey() {
-
$this->sessionMock->expects($this->once())->method('isReady')->willReturn(false);
$this->utilMock->expects($this->once())->method('isMasterKeyEnabled')
->willReturn(true);
@@ -343,7 +339,6 @@ class EncryptionTest extends TestCase {
}
public function testUpdateNoUsers() {
-
$this->invokePrivate($this->instance, 'rememberVersion', [['path' => 2]]);
$this->keyManagerMock->expects($this->never())->method('getFileKey');
@@ -452,5 +447,4 @@ class EncryptionTest extends TestCase {
$this->instance->prepareDecryptAll($input, $output, 'user');
}
-
}
diff --git a/apps/encryption/tests/HookManagerTest.php b/apps/encryption/tests/HookManagerTest.php
index c49938f4f3f..d1b6a4466af 100644
--- a/apps/encryption/tests/HookManagerTest.php
+++ b/apps/encryption/tests/HookManagerTest.php
@@ -56,7 +56,6 @@ class HookManagerTest extends TestCase {
parent::setUpBeforeClass();
// have to make instance static to preserve data between tests
self::$instance = new HookManager();
-
}
@@ -67,7 +66,5 @@ class HookManagerTest extends TestCase {
$hookInstances = self::invokePrivate(self::$instance, 'hookInstances');
$this->assertCount(3, $hookInstances);
-
}
-
}
diff --git a/apps/encryption/tests/Hooks/UserHooksTest.php b/apps/encryption/tests/Hooks/UserHooksTest.php
index c676acb1e90..dcd82fe7e0f 100644
--- a/apps/encryption/tests/Hooks/UserHooksTest.php
+++ b/apps/encryption/tests/Hooks/UserHooksTest.php
@@ -155,7 +155,6 @@ class UserHooksTest extends TestCase {
$this->instance->postPasswordReset($params);
$passwordResetUsers = $this->invokePrivate($this->instance, 'passwordResetUsers');
$this->assertEmpty($passwordResetUsers);
-
}
/**
@@ -302,7 +301,6 @@ class UserHooksTest extends TestCase {
}
public function XtestSetPasswordNoUser() {
-
$userSessionMock = $this->getMockBuilder(IUserSession::class)
->disableOriginalConstructor()
->getMock();
@@ -390,7 +388,5 @@ class UserHooksTest extends TestCase {
$this->recoveryMock
]
)->setMethods(['setupFS'])->getMock();
-
}
-
}
diff --git a/apps/encryption/tests/KeyManagerTest.php b/apps/encryption/tests/KeyManagerTest.php
index 02ab30f998c..da5777d75ab 100644
--- a/apps/encryption/tests/KeyManagerTest.php
+++ b/apps/encryption/tests/KeyManagerTest.php
@@ -250,7 +250,6 @@ class KeyManagerTest extends TestCase {
});
$this->instance->userHasKeys($this->userId);
-
}
/**
@@ -286,7 +285,7 @@ class KeyManagerTest extends TestCase {
$instance->expects($this->any())->method('getSystemPrivateKey')->with('masterKeyId')->willReturn('privateMasterKey');
$instance->expects($this->any())->method('getPrivateKey')->with($this->userId)->willReturn('privateUserKey');
- if($useMasterKey) {
+ if ($useMasterKey) {
$this->cryptMock->expects($this->once())->method('decryptPrivateKey')
->with('privateMasterKey', 'masterKeyPassword', 'masterKeyId')
->willReturn('key');
@@ -381,7 +380,6 @@ class KeyManagerTest extends TestCase {
* @param $expected
*/
public function testGetFileKey($uid, $isMasterKeyEnabled, $privateKey, $expected) {
-
$path = '/foo.txt';
if ($isMasterKeyEnabled) {
@@ -422,7 +420,7 @@ class KeyManagerTest extends TestCase {
$this->sessionMock->expects($this->once())->method('getPrivateKey')->willReturn($privateKey);
}
- if($privateKey) {
+ if ($privateKey) {
$this->cryptMock->expects($this->once())
->method('multiKeyDecrypt')
->willReturn(true);
@@ -434,7 +432,6 @@ class KeyManagerTest extends TestCase {
$this->assertSame($expected,
$this->instance->getFileKey($path, $uid)
);
-
}
public function testDeletePrivateKey() {
@@ -467,7 +464,6 @@ class KeyManagerTest extends TestCase {
* @param array $expectedKeys
*/
public function testAddSystemKeys($accessList, $publicKeys, $uid, $expectedKeys) {
-
$publicShareKeyId = 'publicShareKey';
$recoveryKeyId = 'recoveryKey';
@@ -574,7 +570,7 @@ class KeyManagerTest extends TestCase {
$instance->expects($this->any())->method('getMasterKeyPassword')->willReturn('masterKeyPassword');
$this->cryptMock->expects($this->any())->method('generateHeader')->willReturn('header');
- if(empty($masterKey)) {
+ if (empty($masterKey)) {
$this->cryptMock->expects($this->once())->method('createKeyPair')
->willReturn(['publicKey' => 'public', 'privateKey' => 'private']);
$this->keyStorageMock->expects($this->once())->method('setSystemUserKey')
@@ -677,5 +673,4 @@ class KeyManagerTest extends TestCase {
->with('OC_DEFAULT_MODULE', 'test', 'user1');
$this->instance->backupUserKeys('test', 'user1');
}
-
}
diff --git a/apps/encryption/tests/RecoveryTest.php b/apps/encryption/tests/RecoveryTest.php
index 5139e492f26..df5dc3241c0 100644
--- a/apps/encryption/tests/RecoveryTest.php
+++ b/apps/encryption/tests/RecoveryTest.php
@@ -172,7 +172,6 @@ class RecoveryTest extends TestCase {
}
public function testDisableAdminRecovery() {
-
$this->keyManagerMock->expects($this->exactly(2))
->method('checkRecoveryPassword')
->willReturnOnConsecutiveCalls(true, false);
@@ -185,7 +184,6 @@ class RecoveryTest extends TestCase {
}
public function testIsRecoveryEnabledForUser() {
-
$this->configMock->expects($this->exactly(2))
->method('getUserValue')
->willReturnOnConsecutiveCalls('1', '0');
@@ -323,6 +321,4 @@ class RecoveryTest extends TestCase {
}
return null;
}
-
-
}
diff --git a/apps/encryption/tests/SessionTest.php b/apps/encryption/tests/SessionTest.php
index 279111e3c3b..19425cc8531 100644
--- a/apps/encryption/tests/SessionTest.php
+++ b/apps/encryption/tests/SessionTest.php
@@ -54,7 +54,6 @@ class SessionTest extends TestCase {
public function testSetAndGetPrivateKey() {
$this->instance->setPrivateKey('dummyPrivateKey');
$this->assertEquals('dummyPrivateKey', $this->instance->getPrivateKey());
-
}
/**
diff --git a/apps/encryption/tests/Users/SetupTest.php b/apps/encryption/tests/Users/SetupTest.php
index a580ca68e05..44bb2e55e86 100644
--- a/apps/encryption/tests/Users/SetupTest.php
+++ b/apps/encryption/tests/Users/SetupTest.php
@@ -84,7 +84,6 @@ class SetupTest extends TestCase {
* @param bool $expected
*/
public function testSetupUser($hasKeys, $expected) {
-
$this->keyManagerMock->expects($this->once())->method('userHasKeys')
->with('uid')->willReturn($hasKeys);
@@ -107,5 +106,4 @@ class SetupTest extends TestCase {
[false, true]
];
}
-
}
diff --git a/apps/encryption/tests/UtilTest.php b/apps/encryption/tests/UtilTest.php
index d433826cb76..27c1469b031 100644
--- a/apps/encryption/tests/UtilTest.php
+++ b/apps/encryption/tests/UtilTest.php
@@ -216,5 +216,4 @@ class UtilTest extends TestCase {
$this->assertEquals($return, $this->instance->getStorage($path));
}
-
}