aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-01-08 10:51:44 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-01-08 10:51:44 +0100
commit60d4b45e8924b2d8ccc2326a1f463ee9dae32905 (patch)
treebde191dd49f493e70749b56215aff7415128723e /tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php
parent69ae7abe72fd032adbec1c7dc01fca64aea2fbe8 (diff)
downloadnextcloud-server-60d4b45e8924b2d8ccc2326a1f463ee9dae32905.tar.gz
nextcloud-server-60d4b45e8924b2d8ccc2326a1f463ee9dae32905.zip
Clean up 2FA provider registry when a user is deleted
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php')
-rw-r--r--tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php b/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php
index 67eb27cfdee..9be2e64e980 100644
--- a/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php
@@ -131,6 +131,20 @@ class ProviderUserAssignmentDaoTest extends TestCase {
$this->assertCount(1, $data);
}
+ public function testDeleteByUser() {
+ $this->dao->persist('twofactor_fail', 'user1', 1);
+ $this->dao->persist('twofactor_u2f', 'user1', 1);
+ $this->dao->persist('twofactor_fail', 'user2', 0);
+ $this->dao->persist('twofactor_u2f', 'user1', 0);
+
+ $this->dao->deleteByUser('user1');
+
+ $statesUser1 = $this->dao->getState('user1');
+ $statesUser2 = $this->dao->getState('user2');
+ $this->assertCount(0, $statesUser1);
+ $this->assertCount(1, $statesUser2);
+ }
+
public function testDeleteAll() {
$this->dao->persist('twofactor_fail', 'user1', 1);
$this->dao->persist('twofactor_u2f', 'user1', 1);