]> WPIA git - gigi.git/blobdiff - tests/club/wpia/gigi/testUtils/SEClientTest.java
add: ensure that for RA Agent actions certificate login is used
[gigi.git] / tests / club / wpia / gigi / testUtils / SEClientTest.java
index 358a8c1ef4cea043cbb84907ab12939832c0ff72..a77967295bd6c9bc87c33754284bbe8ff307cabd 100644 (file)
@@ -3,15 +3,8 @@ package club.wpia.gigi.testUtils;
 import static org.junit.Assert.*;
 
 import java.io.IOException;
-import java.security.GeneralSecurityException;
-import java.security.KeyPair;
-import java.security.PrivateKey;
-import java.security.cert.X509Certificate;
 
 import club.wpia.gigi.GigiApiException;
-import club.wpia.gigi.dbObjects.Certificate;
-import club.wpia.gigi.dbObjects.Certificate.CSRType;
-import club.wpia.gigi.dbObjects.Digest;
 import club.wpia.gigi.dbObjects.Group;
 import club.wpia.gigi.pages.admin.support.SupportEnterTicketPage;
 
@@ -23,22 +16,7 @@ public abstract class SEClientTest extends ClientTest {
 
     public SEClientTest() throws IOException, GigiApiException {
         grant(u, Group.SUPPORTER);
-        try {
-            KeyPair kp = generateKeypair();
-            String csr = generatePEMCSR(kp, "CN=" + u.getPreferredName().toString());
-            Certificate c = new Certificate(u, u, Certificate.buildDN("CN", u.getPreferredName().toString()), Digest.SHA256, csr, CSRType.CSR, getClientProfile());
-            final PrivateKey pk = kp.getPrivate();
-            await(c.issue(null, "2y", u));
-            final X509Certificate ce = c.cert();
-            c.setLoginEnabled(true);
-            loginCertificate = c;
-            loginPrivateKey = pk;
-            cookie = login(pk, ce);
-        } catch (InterruptedException e) {
-            throw new GigiApiException(e.toString());
-        } catch (GeneralSecurityException e) {
-            throw new GigiApiException(e.toString());
-        }
+        cookie = cookieWithCertificateLogin(u);
         assertEquals(302, post(cookie, SupportEnterTicketPage.PATH, "ticketno=a20140808.8&setTicket=action", 0).getResponseCode());
     }