From c8149a0fcc6150c9b1b26cdc6bdcd239c7d2dc34 Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Thu, 1 Nov 2018 15:58:17 -0600 Subject: [PATCH] Mock swiftutils for overcloud config action test This function is failing and we should properly mock out these external calls in the unit tests. Change-Id: Ib01d3940586a1fb2137c20cc4ea41d2c12f66a32 Closes-Bug: #1801180 --- tripleo_common/tests/actions/test_config.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tripleo_common/tests/actions/test_config.py b/tripleo_common/tests/actions/test_config.py index 01460880d..4a9d62ecb 100644 --- a/tripleo_common/tests/actions/test_config.py +++ b/tripleo_common/tests/actions/test_config.py @@ -60,13 +60,17 @@ class GetOvercloudConfigActionTest(base.TestCase): self.ctx = mock.MagicMock() + @mock.patch('tripleo_common.utils.swift.delete_container') + @mock.patch('tripleo_common.utils.swift.download_container') @mock.patch('tripleo_common.actions.base.TripleOAction.' 'get_orchestration_client') @mock.patch('tripleo_common.utils.config.Config.download_config') @mock.patch('tripleo_common.utils.tarball.create_tarball') def test_run(self, mock_create_tarball, mock_config, - mock_orchestration_client): + mock_orchestration_client, + mock_swift_download, + mock_swift_delete): heat = mock.MagicMock() heat.stacks.get.return_value = mock.MagicMock( stack_name='stack', id='stack_id') @@ -77,6 +81,11 @@ class GetOvercloudConfigActionTest(base.TestCase): self.config_container) action.run(self.ctx) + mock_swift_download.assert_called_once_with(self.swift, + self.config_container, + '/tmp/fake-path') + mock_swift_delete.assert_called_once_with(self.swift, + self.config_container) self.assertEqual(2, self.swift.put_object.call_count) self.assertEqual(mock.call( 'config-overcloud', 'config-overcloud.tar.gz',