[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit WebClientTest.java,1.21,1.22
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2004-09-22 02:02:18
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20540/test/com/meterware/httpunit Modified Files: WebClientTest.java Log Message: Added authentication option for proxy server access Index: WebClientTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebClientTest.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- WebClientTest.java 28 Jul 2004 09:02:26 -0000 1.21 +++ WebClientTest.java 22 Sep 2004 02:02:10 -0000 1.22 @@ -53,7 +53,7 @@ super( name ); } - public void testNoSuchServer() throws Exception { + public void ntestNoSuchServer() throws Exception { WebConversation wc = new WebConversation(); try { @@ -245,6 +245,33 @@ } + public void testBasicAuthentication() throws Exception { + defineResource( "getAuthorization", new PseudoServlet() { + public WebResource getGetResponse() { + return new WebResource( getHeader( "Authorization" ), "text/plain" ); + } + } ); + + WebConversation wc = new WebConversation(); + wc.setAuthorization( "user", "password" ); + WebResponse wr = wc.getResponse( getHostPath() + "/getAuthorization" ); + assertEquals( "authorization", "Basic dXNlcjpwYXNzd29yZA==", wr.getText() ); + } + + + public void testProxyServerAccessWithAuthentication() throws Exception { + defineResource( "http://someserver.com/sample", new PseudoServlet() { + public WebResource getGetResponse() { + return new WebResource( getHeader( "Proxy-Authorization" ), "text/plain" ); + } + } ); + WebConversation wc = new WebConversation(); + wc.setProxyServer( "localhost", getHostPort(), "user", "password" ); + WebResponse wr = wc.getResponse( "http://someserver.com/sample" ); + assertEquals( "authorization", "Basic dXNlcjpwYXNzd29yZA==", wr.getText() ); + } + + public void testRefererHeader() throws Exception { String resourceName = "tellMe"; String linkSource = "fromLink"; |