Skip to content

Commit 0ac15f2

Browse files
author
Ed Morley
committed
Bug X - Make django-rest-framework test requests use content_type json
The default format used to make test requests is `multipart/form-data`, unless overridden using `TEST_REQUEST_DEFAULT_FORMAT`: http://www.django-rest-framework.org/api-guide/testing/#setting-the-default-format Our API only accepts json and html (see `DEFAULT_RENDERER_CLASSES`), so we should have always been setting `TEST_REQUEST_DEFAULT_FORMAT` to `json`, to prevent test failures. However until recently there was a bug preventing those failures: encode/django-rest-framework#3214 Which has now been fixed in django-rest-framwork v3.3.x: encode/django-rest-framework#3410 ...so we must fix this before updating to the latest version of d-r-f.
1 parent 3b8a05b commit 0ac15f2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

treeherder/config/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,8 @@
283283
'rest_framework.authentication.SessionAuthentication',
284284
'hawkrest.HawkAuthentication',
285285
'treeherder.webapp.api.auth.TwoLeggedOauthAuthentication',
286-
)
286+
),
287+
'TEST_REQUEST_DEFAULT_FORMAT': 'json',
287288
}
288289

289290
SITE_URL = os.environ.get("SITE_URL", "http://local.treeherder.mozilla.org")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy