Ticket #784: files_test.diff
-
test_tutorials.py
old new 144 144 self.getPage("/load_tut_module/tut09_files") 145 145 146 146 # Test upload 147 filesize = 10240000 147 148 h = [("Content-type", "multipart/form-data; boundary=x"), 148 ("Content-Length", " 110")]149 ("Content-Length", "%d" % (105+filesize))] 149 150 b = """--x 150 151 Content-Disposition: form-data; name="myFile"; filename="hello.txt" 151 152 Content-Type: text/plain 152 153 153 hello 154 %s 154 155 --x-- 155 """ 156 """ % ("a"*filesize) 156 157 self.getPage('/upload', h, "POST", b) 157 158 self.assertBody('''<html> 158 159 <body> 159 myFile length: 5<br />160 myFile length: %d<br /> 160 161 myFile filename: hello.txt<br /> 161 162 myFile mime-type: text/plain 162 163 </body> 163 </html>''' )164 </html>''' % filesize) 164 165 165 166 # Test download 166 167 self.getPage('/download') … … 201 202 self.assertStatus(500) 202 203 self.assertInBody("If you construct an HTTPError with a 'message'") 203 204 204 205 205 if __name__ == "__main__": 206 206 conf = {'server.socket_host': '127.0.0.1', 207 207 'server.socket_port': 8080,

