use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestFlashAndSelect method testAssertBeanNoNullsOnLastNameAndEnum.
@Test
public void testAssertBeanNoNullsOnLastNameAndEnum() {
String urlPath = "/user/edit/" + 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("<input type=`text` name=`entity.lastName` value=`Hill` class=`input-xlarge`>".replace('`', '\"'));
response.assertContains("<option value=`` >Unselected</option>".replace('`', '\"'));
response.assertContains("<option value=`k` selected=`selected`>Kindergarten</script>".replace('`', '\"'));
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestSyncHibernate method testHibernateNoUserIdWillSaveNewUser.
@Test
public void testHibernateNoUserIdWillSaveNewUser() {
String email = "test2";
HttpDummyRequest req = Requests.createPostRequest("/testmerge", "user.id", "", "user.email", email, "user.name", "blah1", "user.firstName", "blah2", "user.levelOfEducation", LevelEducation.COLLEGE.getDbCode() + "");
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_303_SEEOTHER);
UserTestDbo user2 = loadByEmail(email);
//name changed
Assert.assertEquals("blah1", user2.getName());
//firstname changed
Assert.assertEquals("blah2", user2.getFirstName());
Assert.assertEquals(LevelEducation.COLLEGE, user2.getLevelOfEducation());
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestAsyncHibernate method saveBean.
private String saveBean(String path) {
HttpRequest req = Requests.createRequest(KnownHttpMethod.POST, path);
http11Socket.send(req);
List<FullResponse> responses1 = http11Socket.getResponses();
Assert.assertEquals(0, responses1.size());
List<Runnable> runnables = mockExecutor.getRunnablesScheduled();
runnables.get(0).run();
mockExecutor.clear();
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_303_SEEOTHER);
Header header = response.getResponse().getHeaderLookupStruct().getHeader(KnownHeaderName.LOCATION);
String url = header.getValue();
return url;
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestSyncHibernate method testHibernatePostPartialDataDoesntBlowDataAway.
@Test
public void testHibernatePostPartialDataDoesntBlowDataAway() {
UserTestDbo user = loadDataInDb();
HttpDummyRequest req = Requests.createPostRequest("/testmerge", "user.id", user.getId() + "", "user.name", "blah1", "user.firstName", "blah2");
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_303_SEEOTHER);
UserTestDbo user2 = load(user.getId());
//name changed
Assert.assertEquals("blah1", user2.getName());
//firstname changed
Assert.assertEquals("blah2", user2.getFirstName());
//lastname remained the same
Assert.assertEquals(user.getLastName(), user2.getLastName());
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestSyncHibernate method testRenderAddPage.
@Test
public void testRenderAddPage() {
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/user/new");
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContains("name='' email=''");
}
Aggregations