diff options
| author | Tom Christie | 2011-06-02 12:58:10 +0100 |
|---|---|---|
| committer | Tom Christie | 2011-06-02 12:58:10 +0100 |
| commit | b50492853f537a2473bb0a9eea86c8b0ed6b8824 (patch) | |
| tree | d289d39aacf187a8a0696a4c1c863aabe1472c3a /djangorestframework/tests/accept.py | |
| parent | 7ee9adbe5c03c29cd4a894dd476548f7fe73b5e4 (diff) | |
| parent | fc1640de75511006e89f033c9270ec91a9f1e4d4 (diff) | |
| download | django-rest-framework-b50492853f537a2473bb0a9eea86c8b0ed6b8824.tar.bz2 | |
pull in -dev as 0.2.0
Diffstat (limited to 'djangorestframework/tests/accept.py')
| -rw-r--r-- | djangorestframework/tests/accept.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/djangorestframework/tests/accept.py b/djangorestframework/tests/accept.py index f2a21277..f26de633 100644 --- a/djangorestframework/tests/accept.py +++ b/djangorestframework/tests/accept.py @@ -1,6 +1,6 @@ from django.test import TestCase from djangorestframework.compat import RequestFactory -from djangorestframework.resource import Resource +from djangorestframework.views import View # See: http://www.useragentstring.com/ @@ -18,13 +18,16 @@ class UserAgentMungingTest(TestCase): http://www.gethifi.com/blog/browser-rest-http-accept-headers""" def setUp(self): - class MockResource(Resource): - anon_allowed_methods = allowed_methods = ('GET',) - def get(self, request, auth): + + class MockView(View): + permissions = () + + def get(self, request): return {'a':1, 'b':2, 'c':3} + self.req = RequestFactory() - self.MockResource = MockResource - self.view = MockResource.as_view() + self.MockView = MockView + self.view = MockView.as_view() def test_munge_msie_accept_header(self): """Send MSIE user agent strings and ensure that we get an HTML response, @@ -37,9 +40,9 @@ class UserAgentMungingTest(TestCase): self.assertEqual(resp['Content-Type'], 'text/html') def test_dont_rewrite_msie_accept_header(self): - """Turn off REWRITE_IE_ACCEPT_HEADER, send MSIE user agent strings and ensure + """Turn off _IGNORE_IE_ACCEPT_HEADER, send MSIE user agent strings and ensure that we get a JSON response if we set a */* accept header.""" - view = self.MockResource.as_view(REWRITE_IE_ACCEPT_HEADER=False) + view = self.MockView.as_view(_IGNORE_IE_ACCEPT_HEADER=False) for user_agent in (MSIE_9_USER_AGENT, MSIE_8_USER_AGENT, |
