Testing Multiple Sequential Forms in one Test Function

15 views
Skip to first unread message

James P

unread,
Mar 3, 2014, 1:18:36 PM3/3/14
to django...@googlegroups.com
Hello,

I am having trouble trying to figure out how to test a set of multiple forms being submitted sequentially. I tried using FormWizard which works fine when I test manually in the browser, my session variables pass intact and I can move through multiple forms and do my transaction processing (ie. the FormWizard 'done' method launches and performs this work)

But when I try to run it via the testing functions, I can POST multiple forms sequentially but they never seem to be on the same session or kick off the 'done' method. Is there something I am missing to testing multiple sequential form POST requests?

test code:
    def test_admin_create_user(self):
        resp = self.c.get(reverse('admin_create_user'))
        resp = self.c.post(reverse('admin_create_user'),{
            'admin_reg_user_wizard-current_step': '0',
            '0-CommentLog':'No Comment'
        })
        resp = self.c.post(reverse('admin_create_user'),{
            'admin_reg_user_wizard-current_step': '2',
            '2-ContactTitle':'2',
            '2-ContactType':'1',
        })

I also noticed that the methods in condition_dict in URLS.py do not get called when I run the test POST, but they call fine when manually testing in the browser.
Reply all
Reply to author
Forward
0 new messages