Creating TestUnits for file upload form

2012-06-19 Thread Bojan MIletic
Hello I'm relatively new to Pyramid, so I'm struggling with writing tests for my picture upload form. How can I add picture to the dummy request? Here is the function I would like to test. @view_config(route_name='profile_pic') def profilePictureUpload(request): if 'form.submitted' in request.

Re: file upload

2012-02-08 Thread Chris McDonough
On Wed, 2012-02-08 at 12:40 -0800, Craig Swank wrote: > I made an app with pcreate -t starter and pasted your app's view stuff > in and it worked there as well, started it with pserve and both > uploads worked there as well. > > > On Feb 8, 1:32 pm, Craig Swank wrote: > > Your app also works in

Re: file upload

2012-02-08 Thread Craig Swank
  picture = repr(request.POST['profile_picture']) > >         return Response(picture, content_type='text/plain') > > > if __name__ == '__main__': > >     config = Configurator() > >     config.scan('__main__') > >     serve

Re: file upload

2012-02-08 Thread Craig Swank
;     config = Configurator() >     config.scan('__main__') >     serve(config.make_wsgi_app()) > > > > > > > > On Wed, 2012-02-08 at 12:15 -0800, Craig Swank wrote: > > Forgot to add environment info > > pyramid:  1.3a6 > > python:    2.7

Re: file upload

2012-02-08 Thread Chris McDonough
gurator() config.scan('__main__') serve(config.make_wsgi_app()) On Wed, 2012-02-08 at 12:15 -0800, Craig Swank wrote: > Forgot to add environment info > pyramid: 1.3a6 > python:2.7 > os: ubuntu on a vagrant VM on a mac. > > > On Feb 8, 1:

Re: file upload

2012-02-08 Thread Craig Swank
Forgot to add environment info pyramid: 1.3a6 python:2.7 os: ubuntu on a vagrant VM on a mac. On Feb 8, 1:03 pm, Craig Swank wrote: > Hello, > I just got wailed on by a file upload for about an hour.  Does anyone > know why, when I post this form to my py

file upload

2012-02-08 Thread Craig Swank
Hello, I just got wailed on by a file upload for about an hour. Does anyone know why, when I post this form to my pyramid app: the request.POST['profile_picture'] is an empty string. When I move the position of the csrf_token field like this: Then re