- String error = getError("date=2000-01-01&location=testcase&certify=0&rules=1&CCAAgreed=1&assertion=1&points=10");
- assertTrue(error, !error.startsWith("</div>"));
- error = getError("date=2000-01-01&location=testcase&certify=1&rules=&CCAAgreed=1&assertion=1&points=10");
- assertTrue(error, !error.startsWith("</div>"));
- error = getError("date=2000-01-01&location=testcase&certify=1&rules=1&CCAAgreed=a&assertion=1&points=10");
- assertTrue(error, !error.startsWith("</div>"));
- error = getError("date=2000-01-01&location=testcase&certify=1&rules=1&CCAAgreed=1&assertion=z&points=10");
- assertTrue(error, !error.startsWith("</div>"));
+ executeFails("date=2000-01-01&location=testcase&certify=0&rules=1&assertion=1&points=10");
+ executeFails("date=2000-01-01&location=testcase&certify=1&rules=&assertion=1&points=10");
+ executeFails("date=2000-01-01&location=testcase&certify=1&rules=1&assertion=z&points=10");
+ }
+
+ @Test
+ public void testAssureListingValid() throws IOException {
+ String uniqueLoc = createUniqueName();
+ execute("date=2000-01-01&location=" + uniqueLoc + "&certify=1&rules=1&assertion=1&points=10");
+
+ String cookie = login(assureeM, TEST_PASSWORD);
+ URLConnection url = get(cookie, MyPoints.PATH);
+ String resp = IOUtils.readURL(url);
+ resp = resp.split(Pattern.quote("</table>"))[0];
+ assertThat(resp, containsString(uniqueLoc));
+ }
+
+ @Test
+ public void testAssurerListingValid() throws IOException {
+ String uniqueLoc = createUniqueName();
+ executeSuccess("date=2000-01-01&location=" + uniqueLoc + "&certify=1&rules=1&assertion=1&points=10");
+ String cookie = login(assurerM, TEST_PASSWORD);
+ URLConnection url = get(cookie, MyPoints.PATH);
+ String resp = IOUtils.readURL(url);
+ resp = resp.split(Pattern.quote("</table>"))[1];
+ assertThat(resp, containsString(uniqueLoc));
+ }
+
+ private void executeFails(String query) throws MalformedURLException, IOException {
+ assertThat(execute(query), hasError());
+
+ }
+
+ private void executeSuccess(String query) throws MalformedURLException, IOException {
+ assertThat(execute(query), hasNoError());
+