From 965fd4d3fc890175fd6357d940e6e56a9f33b07a Mon Sep 17 00:00:00 2001
From: Min Min Ren <rminmin@cn.ibm.com>
Date: Sat, 5 Mar 2016 02:57:08 +0800
Subject: [PATCH] Initialise delete_object mock before it's called

Fix the linked bug. delete_object mock should be before it's
called by swiftclient.shell.main function.
Related: https://review.openstack.org/221219

Change-Id: I52143a93c129764c02bba05267f3563c824e82cb
Partial-Bug: #1480223
---
 tests/unit/test_shell.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/unit/test_shell.py b/tests/unit/test_shell.py
index e3ab0bf2..59ed17d6 100644
--- a/tests/unit/test_shell.py
+++ b/tests/unit/test_shell.py
@@ -688,10 +688,10 @@ class TestShell(unittest.TestCase):
             [None, []]
         ]
         connection.return_value.put_object.return_value = EMPTY_ETAG
-        swiftclient.shell.main(argv)
         # create the delete_object child mock here in attempt to fix
         # https://bugs.launchpad.net/python-swiftclient/+bug/1480223
         connection.return_value.delete_object.return_value = None
+        swiftclient.shell.main(argv)
         connection.return_value.put_object.assert_called_with(
             'container',
             self.tmpfile.lstrip('/'),