From: INOPIAE Date: Sat, 13 Aug 2016 09:57:08 +0000 (+0200) Subject: add: new test cases to check country field during verification process X-Git-Url: https://code.wpia.club/?p=gigi.git;a=commitdiff_plain;h=2a62920f111cb873e4b67ca57449f95e654a96e2;ds=sidebyside add: new test cases to check country field during verification process Change-Id: Id8eb64dccac07b33b1f6e4e45f4e9a41fd89e9ad --- diff --git a/tests/org/cacert/gigi/pages/wot/TestAssurance.java b/tests/org/cacert/gigi/pages/wot/TestAssurance.java index 84cd6dc4..b950389b 100644 --- a/tests/org/cacert/gigi/pages/wot/TestAssurance.java +++ b/tests/org/cacert/gigi/pages/wot/TestAssurance.java @@ -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(""))[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(""))[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"); + } + }