diff options
Diffstat (limited to 'tests/Wallabag')
-rw-r--r-- | tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php | 47 |
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'); |