fix: more spontaneous failing test cases
authorFelix Dörre <felix@dogcraft.de>
Thu, 26 Oct 2017 22:05:16 +0000 (00:05 +0200)
committerFelix Dörre <felix@dogcraft.de>
Thu, 26 Oct 2017 22:08:56 +0000 (00:08 +0200)
Change-Id: I5bd3df024d647ca7793bc895f866c60aa6d9d55c

src/club/wpia/gigi/Gigi.java
tests/club/wpia/gigi/pages/wot/TestVerification.java

index 1981876..6a0b793 100644 (file)
@@ -395,7 +395,12 @@ public final class Gigi extends HttpServlet {
                 resp.sendError(403);
                 return;
             }
-            if (p.beforeTemplate(req, resp)) {
+            try {
+                if (p.beforeTemplate(req, resp)) {
+                    return;
+                }
+            } catch (CSRFException e) {
+                resp.sendError(500, "CSRF invalid");
                 return;
             }
             HashMap<String, Object> vars = new HashMap<String, Object>();
index 7a6aed4..eaff941 100644 (file)
@@ -129,6 +129,7 @@ public class TestVerification extends ManagedTest {
         uc.getOutputStream().write(("date=" + validVerificationDateString() + "&location=testcase&countryCode=DE&certify=1&rules=1&assertion=1&points=10").getBytes("UTF-8"));
         uc.getOutputStream().flush();
         assertEquals(500, uc.getResponseCode());
+        uc.getErrorStream().close();
     }
 
     @Test
@@ -138,6 +139,7 @@ public class TestVerification extends ManagedTest {
         uc.getOutputStream().write(("date=" + validVerificationDateString() + "&location=testcase&countryCode=DE&certify=1&rules=1&assertion=1&points=10&csrf=aragc").getBytes("UTF-8"));
         uc.getOutputStream().flush();
         assertEquals(500, uc.getResponseCode());
+        uc.getErrorStream().close();
     }
 
     @Test