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>
This commit is contained in:
parent
8bc381f104
commit
f6cb452037
|
@ -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'
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue