Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2020-04-15 17:44:28 +0300
committerArthur Schiwon <blizzz@arthur-schiwon.de>2020-04-15 17:44:28 +0300
commitf6cb45203755d85b33684b1dab1a91b5b05e8c9a (patch)
tree908124f89b33ba28b9f24c7b7d9dcc5227a79db1 /tests/lib/Security
parent8bc381f1040a207dd090fccc26531ad79f355916 (diff)
add DB tests for credentials manager
these are actually expected to FAIL, because NULL as a userid is not allowed in the schema, but documented to be used on the source Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'tests/lib/Security')
-rw-r--r--tests/lib/Security/CredentialsManagerTest.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/lib/Security/CredentialsManagerTest.php b/tests/lib/Security/CredentialsManagerTest.php
index 8b58542f8c3..b5d4116b293 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'
+ ],
+ [
+ null,
+ 'systemCredentials'
+ ]
+ ];
+ }
}