From: Felix Dörre Date: Thu, 26 Oct 2017 22:05:16 +0000 (+0200) Subject: fix: more spontaneous failing test cases X-Git-Url: https://code.wpia.club/?p=gigi.git;a=commitdiff_plain;h=ca40eec05f7b3e6bd02014c30448af786aace969 fix: more spontaneous failing test cases Change-Id: I5bd3df024d647ca7793bc895f866c60aa6d9d55c --- diff --git a/src/club/wpia/gigi/Gigi.java b/src/club/wpia/gigi/Gigi.java index 19818767..6a0b7936 100644 --- a/src/club/wpia/gigi/Gigi.java +++ b/src/club/wpia/gigi/Gigi.java @@ -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 vars = new HashMap(); diff --git a/tests/club/wpia/gigi/pages/wot/TestVerification.java b/tests/club/wpia/gigi/pages/wot/TestVerification.java index 7a6aed4e..eaff941c 100644 --- a/tests/club/wpia/gigi/pages/wot/TestVerification.java +++ b/tests/club/wpia/gigi/pages/wot/TestVerification.java @@ -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