X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;ds=sidebyside;f=tests%2Forg%2Fcacert%2Fgigi%2Fping%2FTestHTTP.java;h=da9892b41e854cb1735bff4a8d87331ac287e53b;hb=e545cb295b12e3ecb0d777b2f2b6a601c9b27387;hp=dffab08f2413a05bfbe8fdc4f44934cf2f124e5b;hpb=1513e7223708e0f8a04b2e0ceebf27b3469a6bec;p=gigi.git diff --git a/tests/org/cacert/gigi/ping/TestHTTP.java b/tests/org/cacert/gigi/ping/TestHTTP.java index dffab08f..da9892b4 100644 --- a/tests/org/cacert/gigi/ping/TestHTTP.java +++ b/tests/org/cacert/gigi/ping/TestHTTP.java @@ -1,5 +1,6 @@ package org.cacert.gigi.ping; +import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*; import static org.junit.Assume.*; @@ -13,10 +14,14 @@ import java.util.regex.Pattern; import javax.naming.NamingException; +import org.cacert.gigi.GigiApiException; +import org.cacert.gigi.dbObjects.Domain; +import org.cacert.gigi.dbObjects.DomainPingConfiguration; +import org.cacert.gigi.dbObjects.DomainPingType; import org.cacert.gigi.pages.account.domain.DomainOverview; import org.cacert.gigi.testUtils.IOUtils; import org.cacert.gigi.testUtils.PingTest; -import org.cacert.gigi.testUtils.TestEmailReciever.TestMail; +import org.cacert.gigi.testUtils.TestEmailReceiver.TestMail; import org.cacert.gigi.util.RandomToken; import org.junit.Test; @@ -34,21 +39,21 @@ public class TestHTTP extends PingTest { } @Test - public void httpAndMailSuccess() throws IOException, InterruptedException, SQLException { + public void httpAndMailSuccess() throws Exception { testEmailAndHTTP(0, 0, true, true); } @Test - public void httpFailKeyAndMailSuccess() throws IOException, InterruptedException, SQLException { + public void httpFailKeyAndMailSuccess() throws Exception { testEmailAndHTTP(1, 0, false, true); } @Test - public void httpFailValAndMailFail() throws IOException, InterruptedException, SQLException { + public void httpFailValAndMailFail() throws Exception { testEmailAndHTTP(2, 1, false, false); } - public void testEmailAndHTTP(int httpVariant, int emailVariant, boolean successHTTP, boolean successMail) throws IOException, InterruptedException, SQLException { + public void testEmailAndHTTP(int httpVariant, int emailVariant, boolean successHTTP, boolean successMail) throws IOException, InterruptedException, SQLException, GigiApiException { String test = getTestProps().getProperty("domain.http"); assumeNotNull(test); @@ -66,10 +71,9 @@ public class TestHTTP extends PingTest { "&adddomain&csrf=" + csrf; URL u2 = sendDomainForm(u, content); - TestMail mail = getMailReciever().recieve(); + TestMail mail = getMailReciever().receive(); if (emailVariant == 0) { - String link = mail.extractLink(); - new URL(link).openConnection().getHeaderField(""); + mail.verify(); } waitForPings(2); @@ -78,13 +82,30 @@ public class TestHTTP extends PingTest { assertTrue(newcontent, !successHTTP ^ pat.matcher(newcontent).find()); pat = Pattern.compile("