aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2020-04-14 19:59:54 +0200
committerGitHub <noreply@github.com>2020-04-14 19:59:54 +0200
commit35359a23c1308ed7fd943de9f7018cabf83b21e4 (patch)
tree620914990d017b64bd2dda603b7af4a2be120c5f /tests
parent2b21cc8869c9a6cbcc14a10aa6f39a10c3b8c4a0 (diff)
parente349c879faafdd3d8f61aebb257c4c89ccd3da7d (diff)
downloadwallabag-35359a23c1308ed7fd943de9f7018cabf83b21e4.tar.gz
wallabag-35359a23c1308ed7fd943de9f7018cabf83b21e4.tar.zst
wallabag-35359a23c1308ed7fd943de9f7018cabf83b21e4.zip
Merge pull request #4329 from wallabag/add-2fa-disable
Added a button to disable 2FA when enabled
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
index fa93c9c2..b3b3a19a 100644
--- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
@@ -1045,6 +1045,29 @@ class ConfigControllerTest extends WallabagCoreTestCase
1045 $em->flush(); 1045 $em->flush();
1046 } 1046 }
1047 1047
1048 public function testUserDisable2faEmail()
1049 {
1050 $this->logInAs('admin');
1051 $client = $this->getClient();
1052
1053 $crawler = $client->request('GET', '/config/otp/email/disable');
1054
1055 $this->assertSame(302, $client->getResponse()->getStatusCode());
1056
1057 $crawler = $client->followRedirect();
1058
1059 $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text']));
1060 $this->assertContains('flashes.config.notice.otp_disabled', $alert[0]);
1061
1062 // restore user
1063 $em = $this->getEntityManager();
1064 $user = $em
1065 ->getRepository('WallabagUserBundle:User')
1066 ->findOneByUsername('admin');
1067
1068 $this->assertFalse($user->isEmailTwoFactor());
1069 }
1070
1048 public function testUserEnable2faGoogle() 1071 public function testUserEnable2faGoogle()
1049 { 1072 {
1050 $this->logInAs('admin'); 1073 $this->logInAs('admin');
@@ -1099,6 +1122,30 @@ class ConfigControllerTest extends WallabagCoreTestCase
1099 $this->assertEmpty($user->getBackupCodes()); 1122 $this->assertEmpty($user->getBackupCodes());
1100 } 1123 }
1101 1124
1125 public function testUserDisable2faGoogle()
1126 {
1127 $this->logInAs('admin');
1128 $client = $this->getClient();
1129
1130 $crawler = $client->request('GET', '/config/otp/app/disable');
1131
1132 $this->assertSame(302, $client->getResponse()->getStatusCode());
1133
1134 $crawler = $client->followRedirect();
1135
1136 $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text']));
1137 $this->assertContains('flashes.config.notice.otp_disabled', $alert[0]);
1138
1139 // restore user
1140 $em = $this->getEntityManager();
1141 $user = $em
1142 ->getRepository('WallabagUserBundle:User')
1143 ->findOneByUsername('admin');
1144
1145 $this->assertEmpty($user->getGoogleAuthenticatorSecret());
1146 $this->assertEmpty($user->getBackupCodes());
1147 }
1148
1102 public function testExportTaggingRule() 1149 public function testExportTaggingRule()
1103 { 1150 {
1104 $this->logInAs('admin'); 1151 $this->logInAs('admin');