X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=tests%2Fclub%2Fwpia%2Fgigi%2FTestCertificate.java;h=d76c5140cc348b6f4a4fe34f486dc4b3f25bf68d;hb=5c4c654bf3cb637a7ba032d0c7fb2c70b115ea2e;hp=058c029e4146319e41fa7d1de15993ecc27bf650;hpb=628b0bb70786afe5de5ba28a8438261dc31e25a6;p=gigi.git diff --git a/tests/club/wpia/gigi/TestCertificate.java b/tests/club/wpia/gigi/TestCertificate.java index 058c029e..d76c5140 100644 --- a/tests/club/wpia/gigi/TestCertificate.java +++ b/tests/club/wpia/gigi/TestCertificate.java @@ -25,6 +25,7 @@ import club.wpia.gigi.dbObjects.User; import club.wpia.gigi.pages.account.certs.Certificates; import club.wpia.gigi.testUtils.IOUtils; import club.wpia.gigi.testUtils.ManagedTest; +import club.wpia.gigi.util.RandomToken; import sun.security.x509.GeneralNameInterface; public class TestCertificate extends ManagedTest { @@ -159,4 +160,22 @@ public class TestCertificate extends ManagedTest { } } } + + @Test + public void testClientCertDescription() throws IOException, GeneralSecurityException, SQLException, InterruptedException, GigiApiException { + KeyPair kp = generateKeypair(); + String key1 = generatePEMCSR(kp, "CN=testmail@example.com"); + Certificate c = new Certificate(u, u, Certificate.buildDN("CN", "testmail@example.com"), Digest.SHA256, key1, CSRType.CSR, getClientProfile()); + await(c.issue(null, "2y", u)); + String description = RandomToken.generateToken(95) + DIFFICULT_CHARS; + c.setDescription(description); + assertEquals(description, c.getDescription()); + + // test that description is entered to db + int cid = c.getId(); + clearCaches(); + Certificate cn = Certificate.getById(cid); + assertEquals(description, cn.getDescription()); + + } }