use of org.webpieces.webserver.test.ResponseWrapper in project webpieces by deanhiller.
the class TestScopes method testGetStaticFileDoesNotClearFlashMessage.
@Test
public void testGetStaticFileDoesNotClearFlashMessage() {
HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, "/flashmessage");
XFuture<HttpFullResponse> respFuture1 = http11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture1);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
Header header = response.createCookieRequestHeader();
HttpFullRequest req2 = Requests.createRequest(KnownHttpMethod.GET, "/public/fonts.css");
req2.addHeader(header);
XFuture<HttpFullResponse> respFuture = http11Socket.send(req2);
ResponseWrapper response2 = ResponseExtract.waitResponseAndWrap(respFuture);
response2.assertStatusCode(KnownStatusCode.HTTP_200_OK);
Header cookie = response2.getResponse().getHeaderLookupStruct().getHeader(KnownHeaderName.SET_COOKIE);
Assert.assertNull("static routes should not be clearing cookies or things go south", cookie);
}
use of org.webpieces.webserver.test.ResponseWrapper in project webpieces by deanhiller.
the class TestIfGenerator method testIfTag.
@Test
public void testIfTag() {
HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, "/if");
XFuture<HttpFullResponse> respFuture = http11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContains("This should exist");
response.assertNotContains("Negative1");
response.assertNotContains("Negative2");
}
use of org.webpieces.webserver.test.ResponseWrapper in project webpieces by deanhiller.
the class TestIfGenerator method testElseIFTag.
@Test
public void testElseIFTag() {
HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, "/elseif");
XFuture<HttpFullResponse> respFuture = http11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertNotContains("This should not exist");
response.assertContains("This should exist");
response.assertContains("ElseIf1");
}
use of org.webpieces.webserver.test.ResponseWrapper in project webpieces by deanhiller.
the class TestDomainMatching method testStaticFileFromDomain2.
@Test
public void testStaticFileFromDomain2() {
HttpFullRequest req = Requests.createGetRequest("domain2.com", "/public2/myfile");
XFuture<HttpFullResponse> respFuture = httpsSocket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContains("org.webpieces.webserver");
}
use of org.webpieces.webserver.test.ResponseWrapper in project webpieces by deanhiller.
the class TestDomainMatching method testDomain2RequestDomain1Route.
@Test
public void testDomain2RequestDomain1Route() {
HttpFullRequest req = Requests.createGetRequest("domain2.com", "/domain1");
XFuture<HttpFullResponse> respFuture = httpsSocket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_404_NOTFOUND);
response.assertContains("Your page was not found");
}
Aggregations