Django ModelForms - testing forms with model that have M2M inline instance using an intermediate model

2013-12-25 Thread luke lukes
I have invoice/estimates django app, I need to write tests for it. Since I'm a beginner with this, testing forms results hard for me. This is the code - for models, form and admin: # MODELS class Invoice(models.Model): subject = models.ForeignKey( Subject, verbose

Re: Unit Testing forms with hidden fields

2008-12-08 Thread Jason Sidabras
Sounds good. I will probably work with Twill. Thanks! On Dec 8, 10:34 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Mon, 2008-12-08 at 20:16 -0800, Jason Sidabras wrote: > > Sorry, I guess I missed that part. > > > In my template it checks if there is a user logged in or not. If there >

Re: Unit Testing forms with hidden fields

2008-12-08 Thread Malcolm Tredinnick
On Mon, 2008-12-08 at 20:16 -0800, Jason Sidabras wrote: > Sorry, I guess I missed that part. > > In my template it checks if there is a user logged in or not. If there > is not a user, it defaults the hidden field to send_id=1 and has a > form to place an email address. If the user is logged in

Re: Unit Testing forms with hidden fields

2008-12-08 Thread Jason Sidabras
Sorry, I guess I missed that part. In my template it checks if there is a user logged in or not. If there is not a user, it defaults the hidden field to send_id=1 and has a form to place an email address. If the user is logged in the template uses the pk_id from the user (in the case of non-admin

Re: Unit Testing forms with hidden fields

2008-12-08 Thread Malcolm Tredinnick
On Mon, 2008-12-08 at 15:00 -0800, Jason Sidabras wrote: > Hello, > > I am working on adding unit testing to my code and the snag I have > come across is in regards to unit fields. > > When user.is_anonymous() I have a hidden field sender_id = 1 which is > easy to test by: > > from django.test

Unit Testing forms with hidden fields

2008-12-08 Thread Jason Sidabras
Hello, I am working on adding unit testing to my code and the snag I have come across is in regards to unit fields. When user.is_anonymous() I have a hidden field sender_id = 1 which is easy to test by: from django.test.client import Client c = Client() c.post('sender_id': '1', 'post', '') bu

Re: Testing forms

2007-11-16 Thread Thomas Guettler
Responding to myself: I choosed solution 2 (parse HTML form) with the help of ClientForm: http://www.djangosnippets.org/snippets/467/ Comments welcome Am Freitag, 16. November 2007 13:03 schrieb Thomas Guettler: > Hi, > > my has a lot of input widgets which are build from several > newform.f

Testing forms

2007-11-16 Thread Thomas Guettler
Hi, my has a lot of input widgets which are build from several newform.form instances. If I want to test the form with client.post(), I need to pass all values of the input fields in a dictionary, even if I just want to modify one value. It would be nice if I could get all initial values in