I am using nosetests. If I only pass one file in it does not work. The only combination that works is params only without the upload_files.
I also tried wrapping the file contents in a StringIO but only a string or unicode is accepted. I also tried writing a real file to disk first and only providing the tag and filename but that didn't help either. On Wed, Dec 17, 2008 at 12:52 PM, Jorge Vargas <[email protected]> wrote: > > On Wed, Dec 17, 2008 at 3:54 AM, Kurt <[email protected]> wrote: >> >> Hi, I have a controller, that takes a normal param, as well as a >> couple of files as input. It works fine when called from a client, but >> I am having trouble getting a unit test to work. >> >> response = self.app.post(url_for(controller='ff', action='upload'), >> params={'packxml': packxml}), \ >> upload_files = [(tempimageid + '.image', >> tempimagefilename, 'IMAGECONTENTS'), \ >> (tempimageid + '.icon', tempiconfilename, >> 'ICONCONTENTS')]) >> >> If i only pass in the params, but no upload_files then the packxml >> param is correctly passed to the controller in request.params. >> However when I try either the upload_files by itself, or both the >> params and upload_files, then request.params is empty. >> >> My controller would like to access the files as request.params >> ['id'].value >> >> Whats going on here? Are file params passed into the controller in >> some other structure than request.params? If files are passed in, are >> normal params also passed in differently? Can both types of params be >> passed in in the same request using self.app.post? >> >> Any tips would be appreciated. > > are you using webtest?I got equivalent code and it works fine. does it > works with only one file? > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
