diff options
Diffstat (limited to 'apps/encryption/tests')
-rw-r--r-- | apps/encryption/tests/lib/KeyManagerTest.php | 47 | ||||
-rw-r--r-- | apps/encryption/tests/lib/SessionTest.php | 4 |
2 files changed, 5 insertions, 46 deletions
diff --git a/apps/encryption/tests/lib/KeyManagerTest.php b/apps/encryption/tests/lib/KeyManagerTest.php index 040390e827f..5a85007aa57 100644 --- a/apps/encryption/tests/lib/KeyManagerTest.php +++ b/apps/encryption/tests/lib/KeyManagerTest.php @@ -15,20 +15,12 @@ use Test\TestCase; class KeyManagerTest extends TestCase { /** - * @var bool - */ - private static $trashbinState; - /** * @var KeyManager */ private $instance; /** * @var string */ - private static $testUser = 'test-keyManager-user.dot'; - /** - * @var string - */ private $userId; /** @var string */ @@ -55,27 +47,6 @@ class KeyManagerTest extends TestCase { /** @var \PHPUnit_Framework_MockObject_MockObject */ private $configMock; - /** - * - */ - public static function setUpBeforeClass() { - parent::setUpBeforeClass(); - - // Remember files_trashbin state - self::$trashbinState = \OC_App::isEnabled('files_trashbin'); - - // We dont want tests with app files_trashbin enabled - \OC_App::disable('files_trashbin'); - - $userManager = \OC::$server->getUserManager(); - $userManager->get(self::$testUser)->delete(); - $userManager->createUser(self::$testUser, - self::$testUser); - - // Create test user - parent::loginAsUser(self::$testUser); - } - public function setUp() { parent::setUp(); $this->userId = 'user1'; @@ -118,7 +89,6 @@ class KeyManagerTest extends TestCase { ); } - public function testGetPrivateKey() { $this->keyStorageMock->expects($this->any()) ->method('getUserKey') @@ -153,9 +123,6 @@ class KeyManagerTest extends TestCase { $this->assertTrue($this->instance->recoveryKeyExists()); } - /** - * - */ public function testCheckRecoveryKeyPassword() { $this->keyStorageMock->expects($this->any()) ->method('getSystemUserKey') @@ -165,12 +132,10 @@ class KeyManagerTest extends TestCase { ->method('decryptPrivateKey') ->with($this->equalTo('recoveryKey'), $this->equalTo('pass')) ->willReturn('decryptedRecoveryKey'); - $this->assertTrue($this->instance->checkRecoveryPassword('pass')); } - public function testSetPublicKey() { $this->keyStorageMock->expects($this->any()) ->method('setUserKey') @@ -184,7 +149,6 @@ class KeyManagerTest extends TestCase { $this->assertTrue( $this->instance->setPublicKey($this->userId, 'key') ); - } public function testSetPrivateKey() { @@ -214,9 +178,6 @@ class KeyManagerTest extends TestCase { ); } - /** - * - */ public function testInit() { $this->keyStorageMock->expects($this->any()) ->method('getUserKey') @@ -249,7 +210,7 @@ class KeyManagerTest extends TestCase { ); } - public function setSystemPrivateKey() { + public function testSetSystemPrivateKey() { $this->keyStorageMock->expects($this->exactly(1)) ->method('setSystemUserKey') ->with($this->equalTo('keyId.privateKey'), $this->equalTo('key')) @@ -261,9 +222,9 @@ class KeyManagerTest extends TestCase { ); } - public function getSystemPrivateKey() { + public function testGetSystemPrivateKey() { $this->keyStorageMock->expects($this->exactly(1)) - ->method('setSystemUserKey') + ->method('getSystemUserKey') ->with($this->equalTo('keyId.privateKey')) ->willReturn('systemPrivateKey'); @@ -272,6 +233,4 @@ class KeyManagerTest extends TestCase { $this->instance->getSystemPrivateKey('keyId') ); } - - } diff --git a/apps/encryption/tests/lib/SessionTest.php b/apps/encryption/tests/lib/SessionTest.php index dbf3ecc45a1..f7e026808f0 100644 --- a/apps/encryption/tests/lib/SessionTest.php +++ b/apps/encryption/tests/lib/SessionTest.php @@ -35,10 +35,10 @@ class SessionTest extends TestCase { private $sessionMock; /** - * @throws \OCA\Encryption\Exceptions\PrivateKeyMissingException + * @expectedException \OCA\Encryption\Exceptions\PrivateKeyMissingException + * @expectedExceptionMessage Private Key missing for user: please try to log-out and log-in again */ public function testThatGetPrivateKeyThrowsExceptionWhenNotSet() { - $this->setExpectedException('OCA\Encryption\Exceptions\PrivateKeyMissingException', 'no private key stored in session'); $this->instance->getPrivateKey(); } |