]> WPIA git - gigi.git/commitdiff
add: new test cases to check country field during verification process
authorINOPIAE <m.maengel@inopiae.de>
Sat, 13 Aug 2016 09:57:08 +0000 (11:57 +0200)
committerINOPIAE <m.maengel@inopiae.de>
Sat, 13 Aug 2016 15:12:21 +0000 (17:12 +0200)
Change-Id: Id8eb64dccac07b33b1f6e4e45f4e9a41fd89e9ad

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 org.cacert.gigi.GigiApiException;
 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;
@@ -225,7 +227,7 @@ public class TestAssurance extends ManagedTest {
     }
 
     @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");
 
@@ -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));
+        assertThat(resp, containsString(CountryCode.getCountryCode("DE", CountryCode.CountryCodeType.CODE_2_CHARS).getCountry()));
     }
 
     @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);
@@ -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));
+        assertThat(resp, containsString(CountryCode.getCountryCode("DE", CountryCode.CountryCodeType.CODE_2_CHARS).getCountry()));
     }
 
     private void executeFails(String query) throws MalformedURLException, IOException {
@@ -313,4 +317,10 @@ public class TestAssurance extends ManagedTest {
         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");
+    }
+
 }