summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorblizzz <blizzz@arthur-schiwon.de>2020-04-16 11:53:24 +0200
committerGitHub <noreply@github.com>2020-04-16 11:53:24 +0200
commitd55f4183b568aa46daacd266e842bb458ea8ce9d (patch)
tree70e08388ddebbcb4c7049440488f5f6faa6a8789 /tests
parent8971403ada3da110dc0835853e83f231103b11d9 (diff)
parent5437844b7ec24d6011e8f1e4a0df5f727d259ea5 (diff)
downloadnextcloud-server-d55f4183b568aa46daacd266e842bb458ea8ce9d.tar.gz
nextcloud-server-d55f4183b568aa46daacd266e842bb458ea8ce9d.zip
Merge pull request #20505 from nextcloud/fix/noid/system-creds
do not advertise nulled userId for for systemwide credentials
Diffstat (limited to 'tests')
-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..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',
+ ],
+ ];
+ }
}