diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Security/CredentialsManagerTest.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/lib/Security/CredentialsManagerTest.php b/tests/lib/Security/CredentialsManagerTest.php index 8b58542f8c3..9c1a0cb9291 100644 --- a/tests/lib/Security/CredentialsManagerTest.php +++ b/tests/lib/Security/CredentialsManagerTest.php @@ -27,6 +27,9 @@ use OCP\IDBConnection; use OCP\ILogger; use OCP\Security\ICrypto; +/** + * @group DB + */ class CredentialsManagerTest extends \Test\TestCase { /** @var ICrypto */ @@ -106,4 +109,34 @@ class CredentialsManagerTest extends \Test\TestCase { $this->manager->retrieve($userId, $identifier); } + + /** + * @dataProvider credentialsProvider + */ + public function testWithDB($userId, $identifier) { + $credentialsManager = \OC::$server->getCredentialsManager(); + + $secrets = 'Open Sesame'; + + $credentialsManager->store($userId, $identifier, $secrets); + $received = $credentialsManager->retrieve($userId, $identifier); + + $this->assertSame($secrets, $received); + + $removedRows = $credentialsManager->delete($userId, $identifier); + $this->assertSame(1, $removedRows); + } + + public function credentialsProvider() { + return [ + [ + 'alice', + 'privateCredentials' + ], + [ + '', + 'systemCredentials', + ], + ]; + } } |