From aa9c740206d45ded647d772cf9cc57cfb2e568b1 Mon Sep 17 00:00:00 2001 From: Stavros Sachtouris Date: Wed, 13 Mar 2013 12:58:15 +0200 Subject: [PATCH] Finetest Storage.create_directory --- kamaki/clients/pithos/test.py | 15 +-------------- kamaki/clients/storage/test.py | 25 +++++++------------------ 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/kamaki/clients/pithos/test.py b/kamaki/clients/pithos/test.py index cee1c1f..02d3bbd 100644 --- a/kamaki/clients/pithos/test.py +++ b/kamaki/clients/pithos/test.py @@ -336,18 +336,6 @@ class Pithos(TestCase): for arg, val in kwargs.items(): self.assertEqual(OP.mock_calls[-2][2][arg], val) - @patch('%s.put' % pithos_pkg, return_value=FR()) - @patch('%s.set_header' % client_pkg) - def test_create_directory(self, SH, put): - cont = self.client.container - exp_shd = [ - call('Content-Type', 'application/directory'), - call('Content-length', '0')] - exp_put = [call('/%s/%s/%s' % (user_id, cont, obj), success=201)] - self.client.create_directory(obj) - self.assertEqual(PC.set_header.mock_calls, exp_shd) - self.assertEqual(put.mock_calls, exp_put) - def test_get_object_info(self): FR.headers = object_info version = 'v3r510n' @@ -359,8 +347,7 @@ class Pithos(TestCase): call(obj, version=None), call(obj, version=version)]) with patch.object( - PC, - 'object_head', + PC, 'object_head', side_effect=ClientError('Obj not found', 404)): self.assertRaises( ClientError, diff --git a/kamaki/clients/storage/test.py b/kamaki/clients/storage/test.py index d1c580d..109d382 100644 --- a/kamaki/clients/storage/test.py +++ b/kamaki/clients/storage/test.py @@ -316,26 +316,15 @@ class Storage(TestCase): self.assertEqual(SH.mock_calls, exp_shd) self.assertEqual(put.mock_calls, exp_put) - """ - def test_get_object_info(self): + @patch('%s.head' % storage_pkg, return_value=FR()) + def test_get_object_info(self, head): FR.headers = object_info - version = 'v3r510n' - with patch.object(PC, 'object_head', return_value=FR()) as head: - r = self.client.get_object_info(obj) - self.assertEqual(r, object_info) - r = self.client.get_object_info(obj, version=version) - self.assertEqual(head.mock_calls, [ - call(obj, version=None), - call(obj, version=version)]) - with patch.object( - PC, - 'object_head', - side_effect=ClientError('Obj not found', 404)): - self.assertRaises( - ClientError, - self.client.get_object_info, - obj, version=version) + path = '/%s/%s/%s' % (self.client.account, self.client.container, obj) + r = self.client.get_object_info(obj) + self.assertEqual(r, object_info) + self.assertEqual(head.mock_calls[-1], call(path, success=200)) + """ @patch('%s.get_object_info' % pithos_pkg, return_value=object_info) def test_get_object_meta(self, GOI): expected = dict() -- 1.7.10.4