]> WPIA git - gigi.git/blobdiff - tests/org/cacert/gigi/pages/wot/TestAssurance.java
add: new test cases to check country field during verification process
[gigi.git] / tests / org / cacert / gigi / pages / wot / TestAssurance.java
index 84cd6dc44ae12bfd37890d931572a6bd8a81ce41..b950389b07c9922c16667496fa815f2f78920ebb 100644 (file)
@@ -16,7 +16,9 @@ import java.util.Calendar;
 import java.util.Date;
 import java.util.regex.Pattern;
 
 import java.util.Date;
 import java.util.regex.Pattern;
 
+import org.cacert.gigi.GigiApiException;
 import org.cacert.gigi.database.GigiPreparedStatement;
 import org.cacert.gigi.database.GigiPreparedStatement;
+import org.cacert.gigi.dbObjects.CountryCode;
 import org.cacert.gigi.dbObjects.User;
 import org.cacert.gigi.pages.account.MyDetails;
 import org.cacert.gigi.testUtils.IOUtils;
 import org.cacert.gigi.dbObjects.User;
 import org.cacert.gigi.pages.account.MyDetails;
 import org.cacert.gigi.testUtils.IOUtils;
@@ -225,7 +227,7 @@ public class TestAssurance extends ManagedTest {
     }
 
     @Test
     }
 
     @Test
-    public void testAssureListingValid() throws IOException {
+    public void testAssureListingValid() throws IOException, GigiApiException {
         String uniqueLoc = createUniqueName();
         execute("date=" + validVerificationDateString() + "&location=" + uniqueLoc + "&countryCode=DE&certify=1&rules=1&assertion=1&points=10");
 
         String uniqueLoc = createUniqueName();
         execute("date=" + validVerificationDateString() + "&location=" + uniqueLoc + "&countryCode=DE&certify=1&rules=1&assertion=1&points=10");
 
@@ -234,10 +236,11 @@ public class TestAssurance extends ManagedTest {
         String resp = IOUtils.readURL(url);
         resp = resp.split(Pattern.quote("</table>"))[1];
         assertThat(resp, containsString(uniqueLoc));
         String resp = IOUtils.readURL(url);
         resp = resp.split(Pattern.quote("</table>"))[1];
         assertThat(resp, containsString(uniqueLoc));
+        assertThat(resp, containsString(CountryCode.getCountryCode("DE", CountryCode.CountryCodeType.CODE_2_CHARS).getCountry()));
     }
 
     @Test
     }
 
     @Test
-    public void testAssurerListingValid() throws IOException {
+    public void testAssurerListingValid() throws IOException, GigiApiException {
         String uniqueLoc = createUniqueName();
         executeSuccess("date=" + validVerificationDateString() + "&location=" + uniqueLoc + "&countryCode=DE&certify=1&rules=1&assertion=1&points=10");
         String cookie = login(assurerM, TEST_PASSWORD);
         String uniqueLoc = createUniqueName();
         executeSuccess("date=" + validVerificationDateString() + "&location=" + uniqueLoc + "&countryCode=DE&certify=1&rules=1&assertion=1&points=10");
         String cookie = login(assurerM, TEST_PASSWORD);
@@ -245,6 +248,7 @@ public class TestAssurance extends ManagedTest {
         String resp = IOUtils.readURL(url);
         resp = resp.split(Pattern.quote("</table>"))[2];
         assertThat(resp, containsString(uniqueLoc));
         String resp = IOUtils.readURL(url);
         resp = resp.split(Pattern.quote("</table>"))[2];
         assertThat(resp, containsString(uniqueLoc));
+        assertThat(resp, containsString(CountryCode.getCountryCode("DE", CountryCode.CountryCodeType.CODE_2_CHARS).getCountry()));
     }
 
     private void executeFails(String query) throws MalformedURLException, IOException {
     }
 
     private void executeFails(String query) throws MalformedURLException, IOException {
@@ -313,4 +317,10 @@ public class TestAssurance extends ManagedTest {
         assertThat(IOUtils.readURL(uc), hasError());
 
     }
         assertThat(IOUtils.readURL(uc), hasError());
 
     }
+
+    @Test
+    public void testAssureFormNoCountry() throws IOException {
+        executeFails("date=" + validVerificationDateString() + "&location=testcase&countryCode=&certify=1&rules=1&assertion=1&points=10");
+    }
+
 }
 }