Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
edx-platform
Commits
2414a8e4
Commit
2414a8e4
authored
Oct 05, 2017
by
Troy Sankey
Committed by
Dillon Dumesnil
Oct 31, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove PatchedClient, a django 1.4 shim.
parent
8237bd9d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
35 deletions
+0
-35
openedx/core/djangoapps/profile_images/tests/test_views.py
+0
-35
No files found.
openedx/core/djangoapps/profile_images/tests/test_views.py
View file @
2414a8e4
...
@@ -33,40 +33,6 @@ TEST_UPLOAD_DT = datetime.datetime(2002, 1, 9, 15, 43, 01, tzinfo=UTC)
...
@@ -33,40 +33,6 @@ TEST_UPLOAD_DT = datetime.datetime(2002, 1, 9, 15, 43, 01, tzinfo=UTC)
TEST_UPLOAD_DT2
=
datetime
.
datetime
(
2003
,
1
,
9
,
15
,
43
,
01
,
tzinfo
=
UTC
)
TEST_UPLOAD_DT2
=
datetime
.
datetime
(
2003
,
1
,
9
,
15
,
43
,
01
,
tzinfo
=
UTC
)
class
PatchedClient
(
APIClient
):
"""
Patch DRF's APIClient to avoid a unicode error on file upload.
Famous last words: This is a *temporary* fix that we should be
able to remove once we upgrade Django past 1.4.
"""
def
request
(
self
,
*
args
,
**
kwargs
):
"""Construct an API request. """
# DRF's default test client implementation uses `six.text_type()`
# to convert the CONTENT_TYPE to `unicode`. In Django 1.4,
# this causes a `UnicodeDecodeError` when Django parses a multipart
# upload.
#
# This is the DRF code we're working around:
# https://github.com/tomchristie/django-rest-framework/blob/3.1.3/rest_framework/compat.py#L227
#
# ... and this is the Django code that raises the exception:
#
# https://github.com/django/django/blob/1.4.22/django/http/multipartparser.py#L435
#
# Django unhelpfully swallows the exception, so to the application code
# it appears as though the user didn't send any file data.
#
# This appears to be an issue only with requests constructed in the test
# suite, not with the upload code used in production.
#
if
isinstance
(
kwargs
.
get
(
"CONTENT_TYPE"
),
basestring
):
kwargs
[
"CONTENT_TYPE"
]
=
str
(
kwargs
[
"CONTENT_TYPE"
])
return
super
(
PatchedClient
,
self
)
.
request
(
*
args
,
**
kwargs
)
class
ProfileImageEndpointMixin
(
UserSettingsEventTestMixin
):
class
ProfileImageEndpointMixin
(
UserSettingsEventTestMixin
):
"""
"""
Base class / shared infrastructure for tests of profile_image "upload" and
Base class / shared infrastructure for tests of profile_image "upload" and
...
@@ -75,7 +41,6 @@ class ProfileImageEndpointMixin(UserSettingsEventTestMixin):
...
@@ -75,7 +41,6 @@ class ProfileImageEndpointMixin(UserSettingsEventTestMixin):
# subclasses should override this with the name of the view under test, as
# subclasses should override this with the name of the view under test, as
# per the urls.py configuration.
# per the urls.py configuration.
_view_name
=
None
_view_name
=
None
client_class
=
PatchedClient
def
setUp
(
self
):
def
setUp
(
self
):
super
(
ProfileImageEndpointMixin
,
self
)
.
setUp
()
super
(
ProfileImageEndpointMixin
,
self
)
.
setUp
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment