[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit FileUploadTest.java,1.12,1.13 FormSubmit
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2002-11-15 06:27:23
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv22418/test/com/meterware/httpunit Modified Files: FileUploadTest.java FormSubmitTest.java Log Message: 638408: convert line endings to CRLF in Mime encoded messages Index: FileUploadTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/FileUploadTest.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- FileUploadTest.java 24 Jul 2002 17:32:08 -0000 1.12 +++ FileUploadTest.java 15 Nov 2002 02:53:59 -0000 1.13 @@ -24,6 +24,7 @@ import java.io.*; import java.util.StringTokenizer; +import java.net.URLEncoder; import javax.activation.DataSource; @@ -63,6 +64,7 @@ defineResource( "ListParams", new MimeEcho() ); defineWebPage( "Default", "<form method=POST action = \"ListParams\" enctype=\"multipart/form-data\"> " + "<Input type=text name=age value=12>" + + "<Textarea name=comment>first\nsecond</textarea>" + "<Input type=submit name=update value=age>" + "</form>" ); WebConversation wc = new WebConversation(); @@ -70,13 +72,11 @@ WebResponse simplePage = wc.getResponse( request ); WebRequest formSubmit = simplePage.getForms()[0].getRequest(); WebResponse encoding = wc.getResponse( formSubmit ); - assertEquals( "http://dummy?age=12&update=age", "http://dummy?" + encoding.getText().trim() ); + assertEquals( "http://dummy?age=12&comment=first%0D%0Asecond&update=age", "http://dummy?" + encoding.getText().trim() ); } public void testFileParameterValidation() throws Exception { - File file = new File( "temp.html" ); - defineWebPage( "Default", "<form method=POST action = \"ListParams\" enctype=\"multipart/form-data\"> " + "<Input type=file name=message>" + "<Input type=submit name=update value=age>" + @@ -372,7 +372,7 @@ private void appendFieldValue( String parameterName, StringBuffer sb, MimeBodyPart mbp ) throws IOException, MessagingException { - sb.append( parameterName ).append( "=" ).append( mbp.getContent() ); + sb.append( parameterName ).append( "=" ).append( URLEncoder.encode( mbp.getContent().toString(), "iso-8859-1" ) ); } Index: FormSubmitTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/FormSubmitTest.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- FormSubmitTest.java 8 Nov 2002 01:59:38 -0000 1.28 +++ FormSubmitTest.java 15 Nov 2002 02:53:59 -0000 1.29 @@ -521,6 +521,7 @@ WebResponse wr = _wc.getResponse( getHostPath() + "/abc/form.html" ); WebForm form = wr.getForms()[0]; form.setParameter( "text_field-name*", "a value" ); + WebResponse response = form.submit(); assertEquals( "posted parameters", "text_field-name*=a+value&apply=Apply", response.getText() ); } |