mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
parent
54546cee88
commit
89b9e6e5d6
11 changed files with 169 additions and 169 deletions
|
@ -31,11 +31,11 @@ class ConditionalGet(TestCase):
|
|||
self.assertEqual(response.status_code, 304)
|
||||
self.assertEqual(response.content, b'')
|
||||
|
||||
def testWithoutConditions(self):
|
||||
def test_without_conditions(self):
|
||||
response = self.client.get('/condition/')
|
||||
self.assertFullResponse(response)
|
||||
|
||||
def testIfModifiedSince(self):
|
||||
def test_if_modified_since(self):
|
||||
self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = LAST_MODIFIED_STR
|
||||
response = self.client.get('/condition/')
|
||||
self.assertNotModified(response)
|
||||
|
@ -49,7 +49,7 @@ class ConditionalGet(TestCase):
|
|||
response = self.client.get('/condition/')
|
||||
self.assertFullResponse(response)
|
||||
|
||||
def testIfNoneMatch(self):
|
||||
def test_if_none_match(self):
|
||||
self.client.defaults['HTTP_IF_NONE_MATCH'] = '"%s"' % ETAG
|
||||
response = self.client.get('/condition/')
|
||||
self.assertNotModified(response)
|
||||
|
@ -62,7 +62,7 @@ class ConditionalGet(TestCase):
|
|||
response = self.client.get('/condition/')
|
||||
self.assertNotModified(response)
|
||||
|
||||
def testIfMatch(self):
|
||||
def test_if_match(self):
|
||||
self.client.defaults['HTTP_IF_MATCH'] = '"%s"' % ETAG
|
||||
response = self.client.put('/condition/etag/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
@ -70,7 +70,7 @@ class ConditionalGet(TestCase):
|
|||
response = self.client.put('/condition/etag/')
|
||||
self.assertEqual(response.status_code, 412)
|
||||
|
||||
def testBothHeaders(self):
|
||||
def test_both_headers(self):
|
||||
self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = LAST_MODIFIED_STR
|
||||
self.client.defaults['HTTP_IF_NONE_MATCH'] = '"%s"' % ETAG
|
||||
response = self.client.get('/condition/')
|
||||
|
@ -86,45 +86,45 @@ class ConditionalGet(TestCase):
|
|||
response = self.client.get('/condition/')
|
||||
self.assertFullResponse(response)
|
||||
|
||||
def testSingleCondition1(self):
|
||||
def test_single_condition_1(self):
|
||||
self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = LAST_MODIFIED_STR
|
||||
response = self.client.get('/condition/last_modified/')
|
||||
self.assertNotModified(response)
|
||||
response = self.client.get('/condition/etag/')
|
||||
self.assertFullResponse(response, check_last_modified=False)
|
||||
|
||||
def testSingleCondition2(self):
|
||||
def test_single_condition_2(self):
|
||||
self.client.defaults['HTTP_IF_NONE_MATCH'] = '"%s"' % ETAG
|
||||
response = self.client.get('/condition/etag/')
|
||||
self.assertNotModified(response)
|
||||
response = self.client.get('/condition/last_modified/')
|
||||
self.assertFullResponse(response, check_etag=False)
|
||||
|
||||
def testSingleCondition3(self):
|
||||
def test_single_condition_3(self):
|
||||
self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = EXPIRED_LAST_MODIFIED_STR
|
||||
response = self.client.get('/condition/last_modified/')
|
||||
self.assertFullResponse(response, check_etag=False)
|
||||
|
||||
def testSingleCondition4(self):
|
||||
def test_single_condition_4(self):
|
||||
self.client.defaults['HTTP_IF_NONE_MATCH'] = '"%s"' % EXPIRED_ETAG
|
||||
response = self.client.get('/condition/etag/')
|
||||
self.assertFullResponse(response, check_last_modified=False)
|
||||
|
||||
def testSingleCondition5(self):
|
||||
def test_single_condition_5(self):
|
||||
self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = LAST_MODIFIED_STR
|
||||
response = self.client.get('/condition/last_modified2/')
|
||||
self.assertNotModified(response)
|
||||
response = self.client.get('/condition/etag2/')
|
||||
self.assertFullResponse(response, check_last_modified=False)
|
||||
|
||||
def testSingleCondition6(self):
|
||||
def test_single_condition_6(self):
|
||||
self.client.defaults['HTTP_IF_NONE_MATCH'] = '"%s"' % ETAG
|
||||
response = self.client.get('/condition/etag2/')
|
||||
self.assertNotModified(response)
|
||||
response = self.client.get('/condition/last_modified2/')
|
||||
self.assertFullResponse(response, check_etag=False)
|
||||
|
||||
def testInvalidETag(self):
|
||||
def test_invalid_etag(self):
|
||||
self.client.defaults['HTTP_IF_NONE_MATCH'] = r'"\"'
|
||||
response = self.client.get('/condition/etag/')
|
||||
self.assertFullResponse(response, check_last_modified=False)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue