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 {
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
}
+ @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;
+ }
}