use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestHttps method testSecureAndLoggedInAlready.
@Test
public void testSecureAndLoggedInAlready() {
Header cookie = simulateLogin();
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/secure/internal");
req.addHeader(cookie);
httpsSocket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(httpsSocket);
//before we can show you the page, you need to be logged in, redirect to login page...
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContains("This is some home page");
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestHttps method testSecureLoginNotFoundHttpsPage.
@Test
public void testSecureLoginNotFoundHttpsPage() {
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/secure/notFoundPage");
httpsSocket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(httpsSocket);
//Even though the page doesn't exist, we redirect all /secure/* to login page
response.assertStatusCode(KnownStatusCode.HTTP_303_SEEOTHER);
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestHttps method testSameRouteHttpAndHttpsWrongOrder.
@Test
public void testSameRouteHttpAndHttpsWrongOrder() {
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/same");
httpsSocket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(httpsSocket);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
//notice the Https Route page is not shown
response.assertContains("Http Route");
httpsSocket.clear();
httpSocket.send(req);
response = ResponseExtract.assertSingleResponse(httpSocket);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
//notice the Https Route page is not shown
response.assertContains("Http Route");
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestHttps method testSecureLoginHasHttpsPage.
@Test
public void testSecureLoginHasHttpsPage() {
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/secure/internal");
httpsSocket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(httpsSocket);
//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.FullResponse in project webpieces by deanhiller.
the class TestHttps method testUseHttpButGoThroughLoginFilter.
@Test
public void testUseHttpButGoThroughLoginFilter() {
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/secure/randomPage");
httpSocket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(httpSocket);
//Even though the page exists....if accessed over http, it does not exist...
response.assertStatusCode(KnownStatusCode.HTTP_404_NOTFOUND);
}
Aggregations