X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=tests%2Forg%2Fcacert%2Fgigi%2Fpages%2Fwot%2FTestAssurance.java;h=a1d61940a5f4d78ad8867245e53793c57154cb77;hp=ccbe1774139894fd73d607ed26391352815075c2;hb=9474df27407dd99134876f2c8a2a3b6e7d1fae6a;hpb=6d40d3daddfd612250c4e59b55cbd07e65804b8d diff --git a/tests/org/cacert/gigi/pages/wot/TestAssurance.java b/tests/org/cacert/gigi/pages/wot/TestAssurance.java index ccbe1774..a1d61940 100644 --- a/tests/org/cacert/gigi/pages/wot/TestAssurance.java +++ b/tests/org/cacert/gigi/pages/wot/TestAssurance.java @@ -70,7 +70,7 @@ public class TestAssurance extends ManagedTest { URLConnection uc = u.openConnection(); uc.setDoOutput(true); uc.addRequestProperty("Cookie", cookie); - uc.getOutputStream().write(("search&" + query).getBytes()); + uc.getOutputStream().write(("search&" + query).getBytes("UTF-8")); uc.getOutputStream().flush(); return IOUtils.readURL(uc); @@ -86,7 +86,7 @@ public class TestAssurance extends ManagedTest { public void testAssureFormNoCSRF() throws IOException { // override csrf HttpURLConnection uc = (HttpURLConnection) buildupAssureFormConnection(false); - uc.getOutputStream().write(("date=2000-01-01&location=testcase&certify=1&rules=1&CCAAgreed=1&assertion=1&points=10").getBytes()); + uc.getOutputStream().write(("date=2000-01-01&location=testcase&certify=1&rules=1&CCAAgreed=1&assertion=1&points=10").getBytes("UTF-8")); uc.getOutputStream().flush(); assertEquals(500, uc.getResponseCode()); } @@ -95,7 +95,7 @@ public class TestAssurance extends ManagedTest { public void testAssureFormWrongCSRF() throws IOException { // override csrf HttpURLConnection uc = (HttpURLConnection) buildupAssureFormConnection(false); - uc.getOutputStream().write(("date=2000-01-01&location=testcase&certify=1&rules=1&CCAAgreed=1&assertion=1&points=10&csrf=aragc").getBytes()); + uc.getOutputStream().write(("date=2000-01-01&location=testcase&certify=1&rules=1&CCAAgreed=1&assertion=1&points=10&csrf=aragc").getBytes("UTF-8")); uc.getOutputStream().flush(); assertEquals(500, uc.getResponseCode()); } @@ -119,7 +119,7 @@ public class TestAssurance extends ManagedTest { assertNull(executeBasicWebInteraction(assureeCookie, MyDetails.PATH, newName + "&" + newDob + "&processDetails", 0)); - uc.getOutputStream().write(("date=2000-01-01&location=testcase&certify=1&rules=1&CCAAgreed=1&assertion=1&points=10").getBytes()); + uc.getOutputStream().write(("date=2000-01-01&location=testcase&certify=1&rules=1&CCAAgreed=1&assertion=1&points=10").getBytes("UTF-8")); uc.getOutputStream().flush(); String error = fetchStartErrorMessage(IOUtils.readURL(uc)); assertTrue(error, !error.startsWith("")); @@ -127,7 +127,7 @@ public class TestAssurance extends ManagedTest { @Test public void testAssureFormFuture() throws IOException { - SimpleDateFormat sdf = new SimpleDateFormat("YYYY"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); int year = Integer.parseInt(sdf.format(new Date(System.currentTimeMillis()))) + 2; String error = getError("date=" + year + "-01-01&location=testcase&certify=1&rules=1&CCAAgreed=1&assertion=1&points=10"); assertTrue(error, !error.startsWith("")); @@ -189,7 +189,7 @@ public class TestAssurance extends ManagedTest { private String getError(String query) throws MalformedURLException, IOException { URLConnection uc = buildupAssureFormConnection(true); - uc.getOutputStream().write((query).getBytes()); + uc.getOutputStream().write((query).getBytes("UTF-8")); uc.getOutputStream().flush(); String error = fetchStartErrorMessage(IOUtils.readURL(uc)); return error; @@ -200,14 +200,14 @@ public class TestAssurance extends ManagedTest { URLConnection uc = u.openConnection(); uc.addRequestProperty("Cookie", cookie); uc.setDoOutput(true); - uc.getOutputStream().write(("email=" + URLEncoder.encode(assureeM, "UTF-8") + "&day=1&month=1&year=1910&search").getBytes()); + uc.getOutputStream().write(("email=" + URLEncoder.encode(assureeM, "UTF-8") + "&day=1&month=1&year=1910&search").getBytes("UTF-8")); String csrf = getCSRF(uc); uc = u.openConnection(); uc.addRequestProperty("Cookie", cookie); uc.setDoOutput(true); if (doCSRF) { - uc.getOutputStream().write(("csrf=" + csrf + "&").getBytes()); + uc.getOutputStream().write(("csrf=" + csrf + "&").getBytes("UTF-8")); } return uc; }