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
This commit is contained in:
Clay Gerrard
2017-03-09 11:59:01 -08:00
parent 4ccf75fc35
commit 9afe2bafb4

View File

@@ -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"'})