Like this:
class TestUploadController(TestController):
// ....
def test_upload_files(self):
""" Check that upload of text file works. """
files = [("Filedata", "filename.txt", "contents of the file")]
res = self.app.post("/my/upload/path", upload_files = files)
An authenticated user is usually required to download a file, so you may need to pass the extra_environ argument to self.app.post () to get around this.
Read more about the arguments accepted by self.app.post ()
see paste.fixture documentation . source
share