From 9afe2bafb4052bc3d514d6f03992cd8e6a4178cd Mon Sep 17 00:00:00 2001 From: Clay Gerrard Date: Thu, 9 Mar 2017 11:59:01 -0800 Subject: [PATCH] Add another failing test for 412 logging I tried to move res.fix_conditional_response() into the get_log_line method in utils but couldn't find a container request that was *actually* conditional. We return 412 from the container on a couple of bad requests where we really probably shouldn't - but regardless those responses aren't really conditional. Plus I'd have to make a synthetic test in utils somewhere. So this seems better - leave the fix closer to the problem. Change-Id: I76237d5d5025a653e879141b03df863205c59f3a Related-Change-Id: I66c871f1f15fb43f19d59331b05cc7567ce10063 --- test/unit/obj/test_server.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/unit/obj/test_server.py b/test/unit/obj/test_server.py index 7114c78209..2da8401329 100644 --- a/test/unit/obj/test_server.py +++ b/test/unit/obj/test_server.py @@ -2857,6 +2857,15 @@ class TestObjectController(unittest.TestCase): self.assertEqual(resp.status_int, 200) self.assertEqual(resp.etag, etag) + req = Request.blank( + '/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'HEAD'}, + headers={'If-Match': '"11111111111111111111111111111111"'}) + resp = req.get_response(self.object_controller) + self.assertEqual(resp.status_int, 412) + self.assertIn( + '"HEAD /sda1/p/a/c/o" 412 - ', + self.object_controller.logger.get_lines_for_level('info')[-1]) + req = Request.blank( '/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'GET'}, headers={'If-Match': '"11111111111111111111111111111111"'})