Mock Form Post

Diez B. Roggisch deets at nospam.web.de
Tue May 19 18:26:37 EDT 2009


Scooter schrieb:
> On May 19, 3:40 pm, Scooter <slbent... at gmail.com> wrote:
>> Let me qualify this by saying I'm very new to python. I'm doing some
>> work with mod_python and in a function I have defined I am passing in
>> the form and then iterating through the form keys. I'm currently
>> writing my unit tests and I'm trying to mock up a form object with
>> kids so I can emulate my true form post. So I'm attempting to mock up
>> a class that I'm calling "_Fakeform".  I'm lost on how I should do it
>> though. I thought by creating a dictionary object with key value pairs
>> that would satisfy my need but I'm not sure how to get at it when I
>> pass my mocked class in.
> 
> 1 strike against me for poor proof reading.
> 1) While I did mention mod_python I didn't say I was referring to an
> HTML form.
> 2) I said I'm trying to mock up a form object with "kids". No idea how
> I messed that up, but it should be "keys"

If you'd use mod_wsgi, you could create a WSGI-application that's easily 
testable with paste fixture, including filling out forms, following 
redirects and all that.

Diez



More information about the Python-list mailing list