AuthorizationContext ac;
- public TestCertificateRequest() throws GeneralSecurityException, IOException {
+ public TestCertificateRequest() throws GeneralSecurityException, IOException, GigiApiException {
ac = new AuthorizationContext(u, u);
makeAssurer(u.getId());
- grant(email, Group.CODESIGNING);
-
}
@Test
@Test
public void testCodesignModifiedName() throws Exception {
try {
+ u.grantGroup(getSupporter(), Group.CODESIGNING);
CertificateRequest cr = new CertificateRequest(ac, generatePEMCSR(kp, "CN=a ab"));
- cr.update("name", "SHA512", "code-a", null, null, "email:" + email, null, null);
+ cr.update("name", "SHA512", "code-a", null, null, "email:" + email);
+ cr.draft();
+ fail();
} catch (GigiApiException e) {
assertThat(e.getMessage(), containsString("does not match the details"));
}
}
+
+ // TODO annotate that this depends on default config
+ @Test
+ public void testCodesignNoPermModifiedName() throws Exception {
+ try {
+ CertificateRequest cr = new CertificateRequest(ac, generatePEMCSR(kp, "CN=a ab"));
+ cr.update("name", "SHA512", "code-a", null, null, "email:" + email);
+ cr.draft();
+ fail();
+ } catch (GigiApiException e) {
+ assertThat(e.getMessage(), containsString("Certificate Profile is invalid."));
+ }
+
+ }
}