use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestJson method testAsyncJsonGet.
@Test
public void testAsyncJsonGet() {
HttpDummyRequest req = Requests.createJsonRequest(KnownHttpMethod.GET, "/json/async/45");
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContains("{`searchTime`:8,`matches`:[`match1`,`match2`]}".replace("`", "\""));
response.assertContentType("application/json");
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestStaticPaths method testStaticDir.
@Test
public void testStaticDir() {
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/public/staticMeta.txt");
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContains("org.webpieces.webserver.staticpath.app.StaticMeta");
response.assertContentType("text/plain; charset=utf-8");
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestListGenerator method testListTag.
@Test
public void testListTag() {
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/list");
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContains("<td>dean</td><td>5</td><td>red</td>");
response.assertContains("<td>jeff</td><td>2</td><td>blue</td");
response.assertNotContains("You have no accounts at this time");
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestListGenerator method testEmptyList.
@Test
public void testEmptyList() {
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/emptyList");
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertNotContains("<td>dean</td><td>5</td><td>red</td>");
response.assertNotContains("<td>jeff</td><td>2</td><td>blue</td");
response.assertContains("You have no accounts at this time");
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestAHrefTag method testAHref.
@Test
public void testAHref() {
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/ahref");
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContains("<a href=`/verbatim` id=`myid`>My link2</a>".replace('`', '"'));
response.assertContains("<a href=`/if`>My render link2</a>".replace('`', '"'));
response.assertContains("<a href=`/else`>My full route link</a>".replace('`', '"'));
response.assertContains("<a href=`/redirect/Dean+Hiller`>PureALink</a>".replace('`', '"'));
response.assertContains("Link but no ahref='/redirect/Dean+Hiller'");
}
Aggregations