import java.net.URLEncoder;
import org.cacert.gigi.GigiApiException;
-import org.cacert.gigi.User;
-import org.cacert.gigi.testUtils.ManagedTest;
+import org.cacert.gigi.testUtils.ClientTest;
import org.junit.Test;
-public class TestChangePassword extends ManagedTest {
-
- User u = User.getById(createVerifiedUser("fn", "ln", createUniqueName() + "uni@example.org", TEST_PASSWORD));
-
- String cookie;
+public class TestChangePassword extends ClientTest {
String path = ChangePasswordPage.PATH;
@Test
public void testChangePasswordWeb() throws IOException {
- String error = executeBasicWebInteraction(cookie, path, "oldpassword=" + URLEncoder.encode(TEST_PASSWORD, "UTF-8") //
- + "&pword1=" + URLEncoder.encode(TEST_PASSWORD + "v2", "UTF-8")//
- + "&pword2=" + URLEncoder.encode(TEST_PASSWORD + "v2", "UTF-8"));
+ String error = executeBasicWebInteraction(cookie, path,
+ "oldpassword=" + URLEncoder.encode(TEST_PASSWORD, "UTF-8") //
+ + "&pword1=" + URLEncoder.encode(TEST_PASSWORD + "v2", "UTF-8")//
+ + "&pword2=" + URLEncoder.encode(TEST_PASSWORD + "v2", "UTF-8"));
assertNull(error);
assertTrue(isLoggedin(login(u.getEmail(), TEST_PASSWORD + "v2")));
assertFalse(isLoggedin(login(u.getEmail(), TEST_PASSWORD)));
@Test
public void testChangePasswordWebOldWrong() throws IOException {
- String error = executeBasicWebInteraction(cookie, path, "oldpassword=a" + URLEncoder.encode(TEST_PASSWORD, "UTF-8") //
- + "&pword1=" + URLEncoder.encode(TEST_PASSWORD + "v2", "UTF-8")//
- + "&pword2=" + URLEncoder.encode(TEST_PASSWORD + "v2", "UTF-8"));
+ String error = executeBasicWebInteraction(cookie, path,
+ "oldpassword=a" + URLEncoder.encode(TEST_PASSWORD, "UTF-8") //
+ + "&pword1=" + URLEncoder.encode(TEST_PASSWORD + "v2", "UTF-8")//
+ + "&pword2=" + URLEncoder.encode(TEST_PASSWORD + "v2", "UTF-8"));
assertNotNull(error);
assertFalse(isLoggedin(login(u.getEmail(), TEST_PASSWORD + "v2")));
assertTrue(isLoggedin(login(u.getEmail(), TEST_PASSWORD)));
@Test
public void testChangePasswordWebNewWrong() throws IOException {
- String error = executeBasicWebInteraction(cookie, path, "oldpassword=" + URLEncoder.encode(TEST_PASSWORD, "UTF-8") //
- + "&pword1=" + URLEncoder.encode(TEST_PASSWORD + "v2", "UTF-8")//
- + "&pword2=a" + URLEncoder.encode(TEST_PASSWORD + "v2", "UTF-8"));
+ String error = executeBasicWebInteraction(cookie, path,
+ "oldpassword=" + URLEncoder.encode(TEST_PASSWORD, "UTF-8") //
+ + "&pword1=" + URLEncoder.encode(TEST_PASSWORD + "v2", "UTF-8")//
+ + "&pword2=a" + URLEncoder.encode(TEST_PASSWORD + "v2", "UTF-8"));
assertNotNull(error);
assertFalse(isLoggedin(login(u.getEmail(), TEST_PASSWORD + "v2")));
assertTrue(isLoggedin(login(u.getEmail(), TEST_PASSWORD)));