From fc499f3092c616deb6ec5dc089d5a05903538d5c Mon Sep 17 00:00:00 2001 From: madhuri Date: Thu, 6 Mar 2014 12:31:38 +0530 Subject: [PATCH] Added a test for empty metadata Here added a test for setting empty object metadata and checking its value in response headers. Change-Id: I460302661d150364a95bcd7f0ebbbc2a1e95507a --- test/unit/obj/test_server.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/unit/obj/test_server.py b/test/unit/obj/test_server.py index 6a38df6e6c..59555073a5 100755 --- a/test/unit/obj/test_server.py +++ b/test/unit/obj/test_server.py @@ -231,6 +231,19 @@ class TestObjectController(unittest.TestCase): "X-Object-Meta-3" in resp.headers) self.assertEquals(resp.headers['Content-Type'], 'application/x-test') + # Test for empty metadata + timestamp = normalize_timestamp(time()) + req = Request.blank('/sda1/p/a/c/o', + environ={'REQUEST_METHOD': 'POST'}, + headers={'X-Timestamp': timestamp, + 'Content-Type': 'application/x-test', + 'X-Object-Meta-3': ''}) + resp = req.get_response(self.object_controller) + self.assertEqual(resp.status_int, 202) + req = Request.blank('/sda1/p/a/c/o') + resp = req.get_response(self.object_controller) + self.assertEquals(resp.headers["x-object-meta-3"], '') + def test_POST_old_timestamp(self): ts = time() timestamp = normalize_timestamp(ts)