If the purpose is to check for permissions/different display with
logged in vs. anonymous clients/etc, why not eliminate the chance of a
failure in the logout method and just create a new Client? Gives more
flexibility (by calling the client you want) and keeps things simple.
I use a method to test just that, and call it whenever I need to test
a URL for appropriate permissions:
    def check_auth(self, url):
        """
        Checks that url is redirected on non-logged-in client
        """
        client = dj_test.Client()
        for func in 'get', 'post':
            res = getattr(client, func)(url)
            self.failUnlessEqual(res.context[0]['title'], u'Log in')

Maybe I'm missing something but I think that approach covers most
legit testing circumstances.

 -rob

On Aug 16, 7:55 am, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 8/16/07, eXt <[EMAIL PROTECTED]> wrote:
>
>
>
> > Ok, I've got a logout method that should (IMHO) be added to client.py.
> > I can generate patch from it. But what form should have a test and a
> > documentation?
>
> * Test: add a test case to /tests/modeltests/test_client that
> validates that logout works. The existing tests for the login function
> should give you an idea of what sort of thing is required.
>
> * Documentation:
> /docs/testing.txt will require a short description of the new logout
> function. Again, follow the lead of the login function.
>
> The whole lot - code changes, test and docs should all be wrapped up
> in the same diff you produce with svn diff. Also, don't forget to open
> a ticket to track the change, and provide somewhere to store your
> patch.
>
> Yours,
> Russ Magee %-)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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