X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=tests%2Fclub%2Fwpia%2Fgigi%2Fpages%2Fadmin%2FTestSEAdminPageCertSearch.java;fp=tests%2Fclub%2Fwpia%2Fgigi%2Fpages%2Fadmin%2FTestSEAdminPageCertSearch.java;h=0d556419bbdd8095139b60928eda63925bce1f39;hp=cf9b403b253aa6438b7c38f0483e39832b0120ae;hb=374e616d077431214c8128e3bf5ac3045a088aae;hpb=b1b6ee219140ff4ca4c3e3dfcb1d17dd3f653e17 diff --git a/tests/club/wpia/gigi/pages/admin/TestSEAdminPageCertSearch.java b/tests/club/wpia/gigi/pages/admin/TestSEAdminPageCertSearch.java index cf9b403b..0d556419 100644 --- a/tests/club/wpia/gigi/pages/admin/TestSEAdminPageCertSearch.java +++ b/tests/club/wpia/gigi/pages/admin/TestSEAdminPageCertSearch.java @@ -1,5 +1,6 @@ package club.wpia.gigi.pages.admin; +import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*; import java.io.IOException; @@ -89,6 +90,24 @@ public class TestSEAdminPageCertSearch extends SEClientTest { assertThat(result, CoreMatchers.containsString("N/A")); } + @Test + public void testShowDraft() throws GeneralSecurityException, IOException, GigiApiException, InterruptedException { + KeyPair kp = generateKeypair(); + String key = generatePEMCSR(kp, "CN=" + certMail); + Certificate c1 = new Certificate(u, u, Certificate.buildDN("CN", certMail), Digest.SHA512, key, CSRType.CSR, getClientProfile(), new Certificate.SubjectAlternateName(SANType.EMAIL, certMail)); + URLConnection uc = post(cookie, FindCertPage.PATH, "certType=email&process=Next&cert=" + URLEncoder.encode(certMail, "UTF-8"), 0); + String result = IOUtils.readURL(uc); + assertThat(result, CoreMatchers.containsString(c.getSerial())); + assertThat(result, CoreMatchers.containsString("Draft")); + + await(c1.issue(null, "2y", u)); + uc = post(cookie, FindCertPage.PATH, "certType=email&process=Next&cert=" + URLEncoder.encode(certMail, "UTF-8"), 0); + result = IOUtils.readURL(uc); + assertThat(result, CoreMatchers.containsString(c.getSerial())); + assertThat(result, CoreMatchers.containsString(c1.getSerial())); + assertThat(result, not(CoreMatchers.containsString("Draft"))); + } + private Certificate createCertificate() throws GeneralSecurityException, IOException, GigiApiException, InterruptedException { User u1 = User.getById(id); KeyPair kp = generateKeypair();