]> WPIA git - gigi.git/blobdiff - tests/org/cacert/gigi/pages/wot/TestAssurance.java
Enforce Date-of-births to be day-only.
[gigi.git] / tests / org / cacert / gigi / pages / wot / TestAssurance.java
index ffc9ea5788fc1f83f04b229572fdf88aad79a6ba..3468f1f4c669b014b1847f65ec28173ad11bb837 100644 (file)
@@ -107,27 +107,42 @@ public class TestAssurance extends ManagedTest {
 
     @Test
     public void testAssureFormRaceName() throws IOException, SQLException {
-        testAssureFormRace(true);
+        testAssureFormRace(true, false);
     }
 
     @Test
     public void testAssureFormRaceDoB() throws IOException, SQLException {
-        testAssureFormRace(false);
+        testAssureFormRace(false, false);
     }
 
-    public void testAssureFormRace(boolean name) throws IOException, SQLException {
+    @Test
+    public void testAssureFormRaceNameBlind() throws IOException, SQLException {
+        testAssureFormRace(true, true);
+    }
+
+    @Test
+    public void testAssureFormRaceDoBBlind() throws IOException, SQLException {
+        testAssureFormRace(false, true);
+    }
+
+    public void testAssureFormRace(boolean name, boolean succeed) throws IOException, SQLException {
         URLConnection uc = buildupAssureFormConnection(true);
 
         String assureeCookie = login(assureeM, TEST_PASSWORD);
-        String newName = "lname=" + (name ? "c" : "a") + "&fname=a&mname=&suffix=";
-        String newDob = "day=1&month=1&year=" + (name ? 1910 : 1911);
+        String newName = "lname=" + (name && !succeed ? "a" : "c") + "&fname=a&mname=&suffix=";
+        String newDob = "day=1&month=1&year=" + ( !name && !succeed ? 1911 : 1910);
 
         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("UTF-8"));
         uc.getOutputStream().flush();
         String error = fetchStartErrorMessage(IOUtils.readURL(uc));
-        assertTrue(error, !error.startsWith("</div>"));
+        if (succeed) {
+            assertNull(error);
+        } else {
+            assertTrue(error, !error.startsWith("</div>"));
+            assertThat(error, containsString("changed his personal details"));
+        }
     }
 
     @Test