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
This commit is contained in:
Min Min Ren 2016-03-05 02:57:08 +08:00
parent b65d994937
commit 965fd4d3fc

@ -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('/'),