Skip to content

Commit

Permalink
tests: Don't use private method _headers
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Apr 13, 2021
1 parent fbb34a9 commit 5c6d6fd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/core/tests/resources.py
Expand Up @@ -4937,15 +4937,15 @@ def test_browser_cache(self):
self.assertEqual(resp.status_code, 200)
self.assertEqual(resp.content.decode('utf-8'), '{"content": "This is my very first post using my shiny new API. Pretty sweet, huh?", "created": "2010-03-30T20:05:00", "id": 1, "is_active": true, "resource_uri": "/api/v1/notes/1/", "slug": "first-post", "title": "First Post!", "updated": "2010-03-30T20:05:00"}')
self.assertTrue(resp.has_header('Cache-Control'))
self.assertEqual(resp._headers['cache-control'], ('Cache-Control', 'no-cache'))
self.assertEqual(resp['Cache-Control'], ('Cache-Control', 'no-cache'))

# Now as Ajax.
request.META = {'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest'}
resp = resource.wrap_view('dispatch_detail')(request, pk=1)
self.assertEqual(resp.status_code, 200)
self.assertEqual(resp.content.decode('utf-8'), '{"content": "This is my very first post using my shiny new API. Pretty sweet, huh?", "created": "2010-03-30T20:05:00", "id": 1, "is_active": true, "resource_uri": "/api/v1/notes/1/", "slug": "first-post", "title": "First Post!", "updated": "2010-03-30T20:05:00"}')
self.assertTrue(resp.has_header('cache-control'))
self.assertEqual(resp._headers['cache-control'], ('Cache-Control', 'no-cache'))
self.assertEqual(resp['Cache-Control'], ('Cache-Control', 'no-cache'))

def test_custom_paginator(self):
mock_request = MockRequest()
Expand Down

0 comments on commit 5c6d6fd

Please sign in to comment.