use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestFlashAndSelect method testRenderGetMultiselect.
@Test
public void testRenderGetMultiselect() {
String urlPath = "/multiselect/" + user.getId();
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, urlPath);
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
//assert the nulls came through
response.assertContains("<option value=`b` selected=`selected`>Badass</script>".replace('`', '\"'));
response.assertContains("<option value=`j` >Jerk</script>".replace('`', '\"'));
response.assertContains("<option value=`d` selected=`selected`>Delinquint</script>".replace('`', '\"'));
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestFlashAndSelect method testNullWillFlashProperly.
@Test
public void testNullWillFlashProperly() {
HttpDummyRequest req1 = Requests.createPostRequest("/user/post", "entity.id", user.getId() + "", //invalid first name
"entity.firstName", //invalid first name
"NextName", "entity.email", "dean@zz.com", "entity.lastName", "", "entity.password", "", "entity.levelOfEducation", "");
http11Socket.send(req1);
FullResponse response1 = ResponseExtract.assertSingleResponse(http11Socket);
response1.assertStatusCode(KnownStatusCode.HTTP_303_SEEOTHER);
String urlPath = "/user/edit/" + user.getId();
Assert.assertEquals("http://myhost.com" + urlPath, response1.getRedirectUrl());
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, urlPath);
Header cookieHeader = response1.createCookieRequestHeader();
req.addHeader(cookieHeader);
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
//assert the nulls came through
response.assertContains("<input type=`text` name=`entity.lastName` value=`` class=`input-xlarge`>".replace('`', '\"'));
response.assertContains("<option value=`` selected=`selected`>Unselected</option>".replace('`', '\"'));
response.assertContains("<option value=`k` >Kindergarten</script>".replace('`', '\"'));
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestSyncHibernate method readBean.
private void readBean(String redirectUrl, String email) {
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, redirectUrl);
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContains("name=SomeName email=" + email);
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestSyncHibernate method testReverseAddAndEditFromRouteId.
@Test
public void testReverseAddAndEditFromRouteId() {
loadDataInDb();
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/user/list");
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContains("<a href=`/user/new`>Add User</a>".replace("`", "\""));
response.assertContains("<a href=`/user/edit/1`>Edit</a>".replace("`", "\""));
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestSyncHibernate method testRenderEditPage.
@Test
public void testRenderEditPage() {
int id = loadDataInDb().getId();
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/user/edit/" + id);
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContains("name='SomeName' email='dean2@sync.xsoftware.biz'");
}
Aggregations