[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit WebClientTest.java,1.13,1.14 WebFrameTes
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2003-03-23 01:43:22
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv2570/test/com/meterware/httpunit
Modified Files:
WebClientTest.java WebFrameTest.java
Log Message:
Use request URL to select cookies, not connection URL
Index: WebClientTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebClientTest.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- WebClientTest.java 19 Mar 2003 19:08:59 -0000 1.13
+++ WebClientTest.java 23 Mar 2003 01:43:15 -0000 1.14
@@ -350,12 +350,25 @@
defineResource( "whereAmI", new PseudoServlet() {
public WebResource getGetResponse() throws IOException {
- return new WebResource( "found host header: " + getHeader( "Host" ) );
+ WebResource webResource = new WebResource( "found host header: " + getHeader( "Host" ) );
+ webResource.addHeader( "Set-Cookie: type=short" );
+ return webResource;
}
} );
+ defineResource( "checkCookies", new PseudoServlet() {
+ public WebResource getGetResponse() throws IOException {
+ return new WebResource( "found cookies: " + getHeader( "Cookie" ) );
+ }
+ } );
+
+
WebResponse wr = wc.getResponse( "http://meterware.com:" + getHostPort() + "/whereAmI" );
assertEquals( "Submitted host header", "found host header: meterware.com:" + getHostPort(), wr.getText() );
+ assertEquals( "Returned cookie 'type'", "short", wc.getCookieValue( "type" ) );
+
+ wr = wc.getResponse( "http://meterware.com:" + getHostPort() + "/checkCookies" );
+ assertEquals( "Submitted cookie header", "found cookies: type=short", wr.getText() );
}
Index: WebFrameTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebFrameTest.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- WebFrameTest.java 27 Feb 2003 23:36:04 -0000 1.15
+++ WebFrameTest.java 23 Mar 2003 01:43:15 -0000 1.16
@@ -328,6 +328,7 @@
defineWebPage( "Linker", "<form action=redirect.html target=_self><input type=text name=sample value=z></form>" );
defineResource( "redirect.html?sample=z", "", HttpURLConnection.HTTP_MOVED_PERM );
addResourceHeader( "redirect.html?sample=z", "Location: " + getHostPath() + "/Target.html" );
+ addResourceHeader( "redirect.html?sample=z", "Connection: close" ); // TODO see why this is needed and remove it
_wc.getResponse( getHostPath() + "/Frames.html" );
WebResponse response = _wc.getResponse( _wc.getFrameContents( "red" ).getForms()[0].getRequest() );
@@ -340,6 +341,7 @@
public void testSubFrameRedirect() throws Exception {
defineResource( "Linker.html", "", HttpURLConnection.HTTP_MOVED_PERM );
addResourceHeader( "Linker.html", "Location: " + getHostPath() + "/Target.html" );
+ addResourceHeader( "Linker.html", "Connection: close" ); // TODO see why this is needed and remove it
_wc.getResponse( getHostPath() + "/Frames.html" );
assertMatchingSet( "Frames defined for the conversation", new String[] { "_top", "red", "blue" }, _wc.getFrameNames() );
|