add: more tests for revocation by support
authorFelix Dörre <felix@dogcraft.de>
Sun, 20 Aug 2017 23:14:38 +0000 (01:14 +0200)
committerLucas Werkmeister <mail@lucaswerkmeister.de>
Sat, 26 Aug 2017 19:11:35 +0000 (21:11 +0200)
Change-Id: I1022e5e6cb743f1009f40157f9d9ce72645223fa

tests/club/wpia/gigi/pages/admin/TestSEAdminPageCertSearch.java
tests/club/wpia/gigi/testUtils/ConfiguredTest.java

index a42aef8..dd7d197 100644 (file)
@@ -24,6 +24,7 @@ import club.wpia.gigi.pages.admin.support.FindCertPage;
 import club.wpia.gigi.pages.admin.support.SupportEnterTicketPage;
 import club.wpia.gigi.testUtils.ClientTest;
 import club.wpia.gigi.testUtils.IOUtils;
+import club.wpia.gigi.testUtils.TestEmailReceiver.TestMail;
 import club.wpia.gigi.util.ServerConstants;
 import club.wpia.gigi.util.ServerConstants.Host;
 
@@ -72,6 +73,22 @@ public class TestSEAdminPageCertSearch extends ClientTest {
     public void testRevoke() throws IOException {
         URLConnection conn = post(Certificates.SUPPORT_PATH + "/" + c.getSerial(), "action=revoke");
         assertEquals("https://" + ServerConstants.getHostNamePortSecure(Host.WWW) + Certificates.SUPPORT_PATH + "/" + c.getSerial(), conn.getHeaderField("Location"));
+        boolean hadSupport = false;
+        boolean hadUser = false;
+        for (int i = 0; i < 2; i++) {
+            TestMail tm = getMailReceiver().receive();
+            if (tm.getTo().equals(ServerConstants.getSupportMailAddress())) {
+                hadSupport = true;
+            } else if (tm.getTo().equals(certMail)) {
+                hadUser = true;
+            } else {
+                throw new Error("Unknown mail:" + tm.getTo());
+            }
+            assertThat(tm.getMessage(), CoreMatchers.containsString(certMail));
+            assertThat(tm.getMessage(), CoreMatchers.containsString(c.getSerial()));
+        }
+        assertTrue(hadSupport);
+        assertTrue(hadUser);
         assertEquals(CertificateStatus.REVOKED, c.getStatus());
     }
 
index 483f25e..4dd091e 100644 (file)
@@ -131,6 +131,7 @@ public abstract class ConfiguredTest {
         mainProps.setProperty("name.www", testProps.getProperty("name.www"));
         mainProps.setProperty("name.static", testProps.getProperty("name.static"));
         mainProps.setProperty("name.api", testProps.getProperty("name.api"));
+        mainProps.setProperty("name.suffix", testProps.getProperty("name.suffix"));
 
         mainProps.setProperty("appName", "SomeCA");
         mainProps.setProperty("appIdentifier", "someca");