Here you go.

import unittest
from django.test.client import Client

class BeatTheDrumTests( unittest.TestCase ):
        def setUp( self ):
                self.client = Client()

        def test_POST_btd_select_army( self ):
                response = self.client.post("/btd/select_army/",
{"army" : 1})

                self.failUnlessEqual(response.status_code, 200, "POST /
btd/select_army/ did not return 200 OK")

               # Test for session here. In Rails this would be
something like
               # assert_equal( session[:army], 1)


Regards,
Manoj


On Feb 9, 11:49 am, Margaret <[EMAIL PROTECTED]> wrote:
> would you like paste your code of "test"?
>
> On 2/9/07, Manoj  Govindan <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
> > I have written a small test making use of test.Client to simulate a
> > 'POST' request to a view. The target view is expected to set a certain
> > variable in the session on successful handling of the request. Can
> > anyone suggest a suitable mechanism to check in the test if the
> > session variable has been set correctly?
>
> > Thanks,
> > Manoj
>
> --
> [EMAIL PROTECTED]
> 13585201588


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to