]> WPIA git - gigi.git/commitdiff
fix: external password-reset-by-assurance-TestCase
authorFelix Dörre <felix@dogcraft.de>
Mon, 16 Nov 2015 08:49:24 +0000 (09:49 +0100)
committerFelix Dörre <felix@dogcraft.de>
Mon, 16 Nov 2015 09:08:21 +0000 (10:08 +0100)
src/org/cacert/gigi/Gigi.java
tests/org/cacert/gigi/pages/account/TestPasswordResetExternal.java

index 59273a32e4608ecde1ebe96c583acb26cce0a209..b7605e876373d4d1637375a29acda736559da3ed 100644 (file)
@@ -366,6 +366,8 @@ public class Gigi extends HttpServlet {
                 return;
             }
             HashMap<String, Object> vars = new HashMap<String, Object>();
+            // System.out.println(req.getMethod() + ": " + req.getPathInfo() +
+            // " -> " + p);
             Outputable content = new Outputable() {
 
                 @Override
index 8acef6b2d451ea49df3872cc82c1b63216f463e8..04b927a37a38f2e1a291061ef2569b6341315752 100644 (file)
@@ -5,12 +5,14 @@ import static org.junit.Assert.*;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLConnection;
 import java.net.URLEncoder;
 
 import org.cacert.gigi.dbObjects.User;
+import org.cacert.gigi.pages.PasswordResetPage;
 import org.cacert.gigi.pages.wot.TestAssurance;
 import org.cacert.gigi.testUtils.ClientTest;
 import org.cacert.gigi.testUtils.IOUtils;
@@ -32,9 +34,9 @@ public class TestPasswordResetExternal extends ClientTest {
         assertNull(error);
 
         TestMail mail = getMailReciever().receive();
-        System.out.println(mail.getMessage());
         String link = mail.extractLink();
         String npw = TEST_PASSWORD + "'";
+        System.out.println(link);
         assertNotNull(toPasswordReset(avalue, link, npw, npw + "'"));
         assertNotNull(toPasswordReset(avalue + "'", link, npw, npw));
         assertNotNull(toPasswordReset(avalue, link, "a", "a"));
@@ -48,11 +50,13 @@ public class TestPasswordResetExternal extends ClientTest {
         String headerField = uc2.getHeaderField("Set-Cookie");
         assertNotNull(headerField);
         String cookie3 = stripCookie(headerField);
-        uc2 = new URL(link).openConnection();
+        uc2 = new URL("https://" + getServerName() + PasswordResetPage.PATH).openConnection();
         cookie(uc2, cookie3);
         uc2.setDoOutput(true);
         OutputStream o = uc2.getOutputStream();
         o.write(("csrf=" + csrf + "&pword1=" + URLEncoder.encode(npw, "UTF-8") + "&pword2=" + URLEncoder.encode(npw2, "UTF-8") + "&private_token=" + URLEncoder.encode(avalue, "UTF-8")).getBytes("UTF-8"));
-        return fetchStartErrorMessage(IOUtils.readURL(uc2));
+        System.out.println(((HttpURLConnection) uc2).getResponseCode());
+        String readURL = IOUtils.readURL(uc2);
+        return fetchStartErrorMessage(readURL);
     }
 }