Ticket #3210: test-client-absolute-urls.diff
File test-client-absolute-urls.diff, 1.1 KB (added by , 18 years ago) |
---|
-
django/test/client.py
1 1 from cStringIO import StringIO 2 from urlparse import urlparse 2 3 from django.core.handlers.base import BaseHandler 3 4 from django.core.handlers.wsgi import WSGIRequest 4 5 from django.dispatch import dispatcher … … 192 193 if response.status_code != 302: 193 194 return False 194 195 195 login_path, data = response['Location'].split('?')196 _, _, login_path, _, data, _= urlparse(response['Location']) 196 197 next = data.split('=')[1] 197 198 198 199 # Second, GET the login page; required to set up cookies … … 209 210 response = self.post(login_path, data=form_data, **extra) 210 211 211 212 # Login page should 302 redirect to the originally requested page 212 if response.status_code != 302 or response['Location'] != path: 213 if (response.status_code != 302 or 214 urlparse(response['Location'])[2] != path): 213 215 return False 214 216 215 217 # Since we are logged in, request the actual page again