Another thing. I don't know if that's legal or not but I'd also need
to check the query:

self.client.post('/usermanagement/users/create/', {
            'firstname': 'Sherlock',
            'lastname': 'Holmes',
        })

redirects to

/usermanagement/users/filter/?edit=1

(I use some search filters to display only certain group (groups=), or
entries (edit=?))

I don't know if my URL space is okay but it seems assertRedirect could
look like:

    def assertRedirects(self, response, expected_path,
status_code=302):
        """Assert that a response redirected to a specific URL, and
that the
        redirect URL can be loaded.

        """
        self.assertEqual(response.status_code, status_code,
            "Response didn't redirect: Reponse code was %d (expected
%d)" %
                (response.status_code, status_code))

        setattr(response, 'redirected', dict(
            zip(('scheme', 'netloc', 'path', 'params', 'query',
'fragment'),
            urlparse(response['Location']))))

        path = response.redirected['path']
        self.assertEqual(path, expected_path,
            "Response redirected to '%s', expected '%s'" % (path,
expected_path))

So, I would like to use the urlparse the way Russ uses it in the
implementation. There would be no way for me to check the QUERY part
of the redirected url.

        self.assertEqual(response.redirected['query'], 'edit=1')

Or, do you think this is too specific for an interface? Do I have to
parse the response URL by myself?

Jiri

P.S. Should we move this topic to the django-developers group so that
it gets more attention from the right audience?


--~--~---------~--~----~------------~-------~--~----~
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