From 4ffc4ba411f67c8407ba38d082a3a51a96ad7e04 Mon Sep 17 00:00:00 2001 From: Jonathan Hinson Date: Tue, 12 Jan 2016 11:46:21 -0600 Subject: [PATCH] Functional tests for if-match with multiple etags Multiple etags can be provided on an if-match or if-none-match request. This is currently being tested in the unit tests, but not in the functional tests. Since these etags can be modified by middleware, we need functional tests to assert multiple-etag requests are handled correctly. Change-Id: Idc409c85e8aa82b59dc2bc28af6ca2617de82699 --- test/functional/tests.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/functional/tests.py b/test/functional/tests.py index c55133eb70..2ec182253a 100644 --- a/test/functional/tests.py +++ b/test/functional/tests.py @@ -2478,6 +2478,15 @@ class TestFileComparison(Base): self.assertRaises(ResponseError, file_item.read, hdrs=hdrs) self.assert_status(412) + def testIfMatchMultipleEtags(self): + for file_item in self.env.files: + hdrs = {'If-Match': '"bogus1", "%s", "bogus2"' % file_item.md5} + self.assertTrue(file_item.read(hdrs=hdrs)) + + hdrs = {'If-Match': '"bogus1", "bogus2", "bogus3"'} + self.assertRaises(ResponseError, file_item.read, hdrs=hdrs) + self.assert_status(412) + def testIfNoneMatch(self): for file_item in self.env.files: hdrs = {'If-None-Match': 'bogus'} @@ -2487,6 +2496,16 @@ class TestFileComparison(Base): self.assertRaises(ResponseError, file_item.read, hdrs=hdrs) self.assert_status(304) + def testIfNoneMatchMultipleEtags(self): + for file_item in self.env.files: + hdrs = {'If-None-Match': '"bogus1", "bogus2", "bogus3"'} + self.assertTrue(file_item.read(hdrs=hdrs)) + + hdrs = {'If-None-Match': + '"bogus1", "bogus2", "%s"' % file_item.md5} + self.assertRaises(ResponseError, file_item.read, hdrs=hdrs) + self.assert_status(304) + def testIfModifiedSince(self): for file_item in self.env.files: hdrs = {'If-Modified-Since': self.env.time_old_f1}