summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2008-06-06 13:39:42 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2008-06-06 13:39:42 +0000
commit46cd8bb5b6c937969ca281f124307013454f5c15 (patch)
tree392eab0a423865b24f04985bfdc0f67f64a84ffe /tests
parentd234e92740ed6c144f222f15afe33c49fb49d7b7 (diff)
Fixed #7143 -- Modified the test client to better match (most) real browser behavior when uploading files. Now, only the file name is sent, rather than the full path. Thanks for the report, cpinto.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7577 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/test_client_regress/views.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/regressiontests/test_client_regress/views.py b/tests/regressiontests/test_client_regress/views.py
index f44757dc10..97379c1039 100644
--- a/tests/regressiontests/test_client_regress/views.py
+++ b/tests/regressiontests/test_client_regress/views.py
@@ -1,3 +1,5 @@
+import os
+
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseServerError
@@ -13,6 +15,10 @@ def file_upload_view(request):
form_data = request.POST.copy()
form_data.update(request.FILES)
if isinstance(form_data['file_field'], dict) and isinstance(form_data['name'], unicode):
+ # If a file is posted, the dummy client should only post the file name,
+ # not the full path.
+ if os.path.dirname(form_data['file_field']['filename']) != '':
+ return HttpResponseServerError()
return HttpResponse('')
else:
return HttpResponseServerError()