Skip to content

Commit 7850b49

Browse files
committed
Downgrade DRF to 3.8.2
**Purpose** 3.9.0 has a known issue where the browsable API renders unescaped HTML encode/django-rest-framework#6191 (comment) **Changes** Downgrade DRF to latest 3.8.x release **QA Notes** Check https://api.osf.io/v2/schemas/registrations/ to make sure that the Browsable API isn't rendering HTML in the responses **Ticket** No ticket
1 parent 7882edb commit 7850b49

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

api_tests/base/test_versioning.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ def test_browsable_api_defaults_to_latest(self, app):
116116
url = '/v2/?format=api'
117117
res = app.get(url)
118118
assert res.status_code == 200
119-
assert '"version": "{}"'.format(
119+
assert '"version": "{}&quot'.format(
120120
LATEST_VERSIONS[2]
121121
) in res.body
122122

123123
def test_browsable_api_query_version(self, app):
124124
url = '/v2/?format=api&version=2.5'
125125
res = app.get(url)
126126
assert res.status_code == 200
127-
assert '"version": "2.5"' in res.body
127+
assert '"version": "2.5&quot' in res.body
128128

129129
def test_json_defaults_to_default(self, app):
130130
url = '/v2/?format=json'

api_tests/nodes/views/test_node_contributors_list.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2084,7 +2084,7 @@ def test_bulk_update_contributors_errors(
20842084
auth=user.auth,
20852085
expect_errors=True, bulk=True)
20862086
assert res.status_code == 400
2087-
assert res.json['errors'][0]['detail'] == 'Must be a valid boolean.'
2087+
assert res.json['errors'][0]['detail'] == '"true and false" is not a valid boolean.'
20882088

20892089
res = app.get(url_public, auth=user.auth)
20902090
data = res.json['data']
@@ -2502,7 +2502,7 @@ def test_bulk_partial_update_errors(
25022502
auth=user.auth,
25032503
expect_errors=True, bulk=True)
25042504
assert res.status_code == 400
2505-
assert res.json['errors'][0]['detail'] == 'Must be a valid boolean.'
2505+
assert res.json['errors'][0]['detail'] == '"true and false" is not a valid boolean.'
25062506

25072507
res = app.get(url_public, auth=user.auth)
25082508
data = res.json['data']

api_tests/registrations/views/test_registration_detail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def test_fields(
322322
auth=user.auth,
323323
expect_errors=True)
324324
assert res.status_code == 400
325-
assert res.json['errors'][0]['detail'] == 'Must be a valid boolean.'
325+
assert res.json['errors'][0]['detail'] == '"Dr.Strange" is not a valid boolean.'
326326

327327
# test_fields_other_than_public_are_ignored
328328
attribute_list = {

api_tests/users/views/test_user_settings_detail.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def test_update_two_factor_enabled(self, app, user_one, url, payload):
8080
payload['data']['attributes']['two_factor_enabled'] = 'Yes'
8181
res = app.patch_json_api(url, payload, auth=user_one.auth, expect_errors=True)
8282
assert res.status_code == 400
83-
assert res.json['errors'][0]['detail'] == 'Must be a valid boolean.'
83+
assert res.json['errors'][0]['detail'] == '"Yes" is not a valid boolean.'
8484

8585
# Already disabled - nothing happens, still disabled
8686
payload['data']['attributes']['two_factor_enabled'] = False
@@ -194,7 +194,7 @@ def test_bad_payload_patch_400(self, app, user_one, bad_payload, url):
194194
res = app.patch_json_api(url, bad_payload, auth=user_one.auth, expect_errors=True)
195195

196196
assert res.status_code == 400
197-
assert res.json['errors'][0]['detail'] == u'Must be a valid boolean.'
197+
assert res.json['errors'][0]['detail'] == u'"22" is not a valid boolean.'
198198

199199
def test_anonymous_patch_401(self, app, url, payload):
200200
res = app.patch_json_api(url, payload, expect_errors=True)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ raven==5.32.0
6666

6767
# API requirements
6868
Django==1.11.15 # pyup: <2.0 # Remove this when we're on Py3
69-
djangorestframework==3.9.0
69+
djangorestframework==3.8.2
7070
django-cors-headers==2.1.0
7171
djangorestframework-bulk==0.2.1
7272
hashids==1.2.0

0 commit comments

Comments
 (0)