Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Ticket #784: files_test.diff

  • test_tutorials.py

    old new  
    144144        self.getPage("/load_tut_module/tut09_files") 
    145145         
    146146        # Test upload 
     147        filesize = 10240000 
    147148        h = [("Content-type", "multipart/form-data; boundary=x"), 
    148              ("Content-Length", "110")] 
     149             ("Content-Length", "%d" % (105+filesize))] 
    149150        b = """--x 
    150151Content-Disposition: form-data; name="myFile"; filename="hello.txt" 
    151152Content-Type: text/plain 
    152153 
    153 hello 
     154%s 
    154155--x-- 
    155 """ 
     156""" % ("a"*filesize) 
    156157        self.getPage('/upload', h, "POST", b) 
    157158        self.assertBody('''<html> 
    158159        <body> 
    159             myFile length: 5<br /> 
     160            myFile length: %d<br /> 
    160161            myFile filename: hello.txt<br /> 
    161162            myFile mime-type: text/plain 
    162163        </body> 
    163         </html>'''
     164        </html>''' % filesize
    164165     
    165166        # Test download 
    166167        self.getPage('/download') 
     
    201202        self.assertStatus(500) 
    202203        self.assertInBody("If you construct an HTTPError with a 'message'") 
    203204 
    204  
    205205if __name__ == "__main__": 
    206206    conf = {'server.socket_host': '127.0.0.1', 
    207207            'server.socket_port': 8080, 

Hosted by WebFaction

Log in as guest/cpguest to create tickets