use of org.webpieces.webserver.test.ResponseWrapper in project webpieces by deanhiller.
the class TestHttps method testReverseUrlLookupOnHttpPageForHttpsUrl.
@Test
public void testReverseUrlLookupOnHttpPageForHttpsUrl() {
HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, "/same");
XFuture<HttpFullResponse> respFuture = http11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
// since request came in on port 80, url should be port 443
// notice the Https Route page is not shown
response.assertContains("https://myhost.com:443");
}
use of org.webpieces.webserver.test.ResponseWrapper in project webpieces by deanhiller.
the class TestHttps method testSecureLoginNotFoundHttpsPage.
@Test
public void testSecureLoginNotFoundHttpsPage() {
HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, "/secure/notFoundPage");
XFuture<HttpFullResponse> respFuture = https11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
// Page not exist
response.assertStatusCode(KnownStatusCode.HTTP_404_NOTFOUND);
}
use of org.webpieces.webserver.test.ResponseWrapper in project webpieces by deanhiller.
the class TestHttps method testSecureLoginHasHttpsPage.
@Test
public void testSecureLoginHasHttpsPage() {
HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, "/secure/internal");
XFuture<HttpFullResponse> respFuture = https11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
// before we can show you the page, you need to be logged in, redirect to login page...
response.assertStatusCode(KnownStatusCode.HTTP_303_SEEOTHER);
}
use of org.webpieces.webserver.test.ResponseWrapper in project webpieces by deanhiller.
the class TestHttps method testSameRouteHttpAndHttpsWrongOrder.
@Test
public void testSameRouteHttpAndHttpsWrongOrder() {
HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, "/same");
XFuture<HttpFullResponse> respFuture1 = https11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture1);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
// notice the Https Route page is not shown
response.assertContains("Http Route");
XFuture<HttpFullResponse> respFuture = http11Socket.send(req);
response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
// notice the Https Route page is not shown
response.assertContains("Http Route");
}
use of org.webpieces.webserver.test.ResponseWrapper in project webpieces by deanhiller.
the class TestHttps method testUseHttpButGoThroughLoginFilter.
@Test
public void testUseHttpButGoThroughLoginFilter() {
HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, "/secure/randomPage");
XFuture<HttpFullResponse> respFuture = http11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
// Even though the page exists....if accessed over http, it does not exist...
response.assertStatusCode(KnownStatusCode.HTTP_404_NOTFOUND);
}
Aggregations