Search in sources :

Example 1 with AcmeInfo

use of org.webpieces.plugin.secure.sslcert.acme.AcmeInfo in project webpieces by deanhiller.

the class TestSslSetup method testAlreadyLoggedInAndFirstTimeNoProperties.

@Test
public void testAlreadyLoggedInAndFirstTimeNoProperties() throws MalformedURLException {
    URI terms = URI.create("http://somerandom.com/place");
    URL website = new URL("http://website.com");
    mockStorage.addReadResponse(XFuture.completedFuture(new HashMap<>()));
    HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, "/@sslcert");
    // response from logging in taken from TestLogin in backend plugin test suite
    // set-cookie: webSession=1-xjrs6SeNeSxmJQtaTwM8gDorNiQ=:backendUser=admin; path=/; HttpOnly
    req.addHeader(new Header(KnownHeaderName.COOKIE, "webSession=1-xjrs6SeNeSxmJQtaTwM8gDorNiQ=:backendUser=admin"));
    mockAcmeClient.setRemoteInfo(XFuture.completedFuture(new AcmeInfo(terms, website)));
    XFuture<HttpFullResponse> respFuture = https11Socket.send(req);
    ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
    // redirect to the login page in the backend plugin...
    response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
    response.assertContains("You Must agree to the terms found at");
}
Also used : HttpFullResponse(org.webpieces.httpclient11.api.HttpFullResponse) HttpFullRequest(org.webpieces.httpclient11.api.HttpFullRequest) Header(org.webpieces.httpparser.api.common.Header) HashMap(java.util.HashMap) ResponseWrapper(org.webpieces.webserver.test.ResponseWrapper) URI(java.net.URI) URL(java.net.URL) AcmeInfo(org.webpieces.plugin.secure.sslcert.acme.AcmeInfo) WebserverForTest(org.webpieces.plugins.fortesting.WebserverForTest) AbstractWebpiecesTest(org.webpieces.webserver.test.AbstractWebpiecesTest) Test(org.junit.Test)

Example 2 with AcmeInfo

use of org.webpieces.plugin.secure.sslcert.acme.AcmeInfo in project webpieces by deanhiller.

the class TestFullSslSetupWizard method renderFirstPage.

private void renderFirstPage(String url) throws MalformedURLException {
    URI terms = URI.create("http://somerandom.com/place");
    URL website = new URL("http://website.com");
    mockAcmeClient.setRemoteInfo(XFuture.completedFuture(new AcmeInfo(terms, website)));
    HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, url);
    // response from logging in taken from TestLogin in backend plugin test suite
    // set-cookie: webSession=1-xjrs6SeNeSxmJQtaTwM8gDorNiQ=:backendUser=admin; path=/; HttpOnly
    req.addHeader(new Header(KnownHeaderName.COOKIE, "webSession=1-xjrs6SeNeSxmJQtaTwM8gDorNiQ=:backendUser=admin"));
    XFuture<HttpFullResponse> respFuture = https11Socket.send(req);
    ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
    // redirect to the login page in the backend plugin...
    response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
    response.assertContains("You Must agree to the terms found at");
    response.assertContains(terms + "");
}
Also used : HttpFullResponse(org.webpieces.httpclient11.api.HttpFullResponse) HttpFullRequest(org.webpieces.httpclient11.api.HttpFullRequest) Header(org.webpieces.httpparser.api.common.Header) ResponseWrapper(org.webpieces.webserver.test.ResponseWrapper) URI(java.net.URI) URL(java.net.URL) AcmeInfo(org.webpieces.plugin.secure.sslcert.acme.AcmeInfo)

Aggregations

URI (java.net.URI)2 URL (java.net.URL)2 HttpFullRequest (org.webpieces.httpclient11.api.HttpFullRequest)2 HttpFullResponse (org.webpieces.httpclient11.api.HttpFullResponse)2 Header (org.webpieces.httpparser.api.common.Header)2 AcmeInfo (org.webpieces.plugin.secure.sslcert.acme.AcmeInfo)2 ResponseWrapper (org.webpieces.webserver.test.ResponseWrapper)2 HashMap (java.util.HashMap)1 Test (org.junit.Test)1 WebserverForTest (org.webpieces.plugins.fortesting.WebserverForTest)1 AbstractWebpiecesTest (org.webpieces.webserver.test.AbstractWebpiecesTest)1