]> WPIA git - gigi.git/blobdiff - tests/club/wpia/gigi/pages/account/TestChangePassword.java
Merge "add: new function to set a challenge expired via test manager"
[gigi.git] / tests / club / wpia / gigi / pages / account / TestChangePassword.java
index 7a2a6a923f7187f0d7e5bc018f55216713529b4d..73d23c56e8e3e99403da209b1d267446787e5c1e 100644 (file)
@@ -5,10 +5,11 @@ import static org.junit.Assert.*;
 import java.io.IOException;
 import java.net.URLEncoder;
 
+import org.hamcrest.CoreMatchers;
 import org.junit.Test;
 
 import club.wpia.gigi.GigiApiException;
-import club.wpia.gigi.pages.account.ChangePasswordPage;
+import club.wpia.gigi.testUtils.ArrayContains;
 import club.wpia.gigi.testUtils.ClientTest;
 
 public class TestChangePassword extends ClientTest {
@@ -44,6 +45,9 @@ public class TestChangePassword extends ClientTest {
         assertTrue(isLoggedin(login(u.getEmail(), TEST_PASSWORD + "v2")));
         assertFalse(isLoggedin(login(u.getEmail(), TEST_PASSWORD)));
 
+        String[] result = u.getAdminLog();
+        assertThat(result, ArrayContains.contains(CoreMatchers.equalTo("User triggered password reset")));
+
     }
 
     @Test
@@ -103,4 +107,19 @@ public class TestChangePassword extends ClientTest {
 
     }
 
+    @Test
+    public void testChangePasswordCertLogin() throws IOException, GigiApiException {
+        // no cert login
+        String np = URLEncoder.encode(TEST_PASSWORD + "v1", "UTF-8");
+        String error = executeBasicWebInteraction(cookie, path, "pword1=" + np + "&pword2=" + np);
+        assertNotNull(error);
+
+        // cert login
+        cookie = cookieWithCertificateLogin(u);
+        error = executeBasicWebInteraction(cookie, path, "pword1=" + np + "&pword2=" + np);
+        assertNull(error);
+
+        cookie = login(u.getEmail(), TEST_PASSWORD);
+        loginCertificate = null;
+    }
 }