use OCP\ILogger;
use OCP\Security\ICrypto;
+/**
+ * @group DB
+ */
class CredentialsManagerTest extends \Test\TestCase {
/** @var ICrypto */
$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'
+ ]
+ ];
+ }
}