diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2017-12-19 19:58:15 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2017-12-19 20:40:45 +0100 |
commit | 00c01aeafab54ec7b9ea376099fb6aaff0da5f5a (patch) | |
tree | 486d4d762305fdbf9099f2064a0e38998ec15e31 /functest/tests/unit/cli | |
parent | afa5e6098c7fd24ee2a9259a5dbff64a3e2d0a68 (diff) |
Remove openstack_[clean,snapshot]
It also removes the related unit tests and updates docs and cli.
Change-Id: Ie11f77402f2b5b7055a0c7c5d931c8ff21124482
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/tests/unit/cli')
-rw-r--r-- | functest/tests/unit/cli/commands/test_cli_os.py | 77 | ||||
-rw-r--r-- | functest/tests/unit/cli/test_cli_base.py | 20 |
2 files changed, 0 insertions, 97 deletions
diff --git a/functest/tests/unit/cli/commands/test_cli_os.py b/functest/tests/unit/cli/commands/test_cli_os.py index 434370a5..b827e87c 100644 --- a/functest/tests/unit/cli/commands/test_cli_os.py +++ b/functest/tests/unit/cli/commands/test_cli_os.py @@ -66,83 +66,6 @@ class CliOpenStackTesting(unittest.TestCase): self.cli_os.check() self.assertTrue(mock_check_deployment.called) - @mock.patch('functest.cli.commands.cli_os.os.path.isfile', - return_value=False) - @mock.patch('functest.cli.commands.cli_os.click.echo') - def test_snapshot_create(self, mock_click_echo, mock_os_path): - with mock.patch.object(self.cli_os, 'ping_endpoint'), \ - mock.patch('functest.cli.commands.cli_os.os_snapshot.main') \ - as mock_os_snapshot: - self.cli_os.snapshot_create() - mock_click_echo.assert_called_once_with("Generating Openstack " - "snapshot...") - self.assertTrue(mock_os_snapshot.called) - - @mock.patch('functest.cli.commands.cli_os.os.path.isfile', - return_value=True) - @mock.patch('functest.cli.commands.cli_os.click.echo') - def test_snapshot_create_overwrite(self, mock_click_echo, mock_os_path): - with mock.patch('six.moves.input', return_value="y") \ - as mock_raw_input, \ - mock.patch.object(self.cli_os, 'ping_endpoint'), \ - mock.patch('functest.cli.commands.cli_os.os_snapshot.main') \ - as mock_os_snapshot: - self.cli_os.snapshot_create() - mock_click_echo.assert_called_once_with("Generating Openstack " - "snapshot...") - mock_raw_input.assert_any_call("It seems there is already an " - "OpenStack snapshot. Do you want " - "to overwrite it with the current " - "OpenStack status? [y|n]\n") - self.assertTrue(mock_os_snapshot.called) - - @mock.patch('functest.cli.commands.cli_os.os.path.isfile', - return_value=False) - @mock.patch('functest.cli.commands.cli_os.click.echo') - def test_snapshot_show_missing_snap(self, mock_click_echo, mock_os_path): - self.cli_os.snapshot_show() - mock_click_echo.assert_called_once_with("There is no OpenStack " - "snapshot created. To create " - "one run the command " - "'functest openstack " - "snapshot-create'") - - @mock.patch('functest.cli.commands.cli_os.os.path.isfile', - return_value=True) - @mock.patch('functest.cli.commands.cli_os.click.echo') - def test_snapshot_show_default(self, mock_click_echo, mock_os_path): - with mock.patch('six.moves.builtins.open', - mock.mock_open(read_data='0')) \ - as m: - self.cli_os.snapshot_file = self.snapshot_file - self.cli_os.snapshot_show() - m.assert_called_once_with(self.snapshot_file, 'r') - mock_click_echo.assert_called_once_with("\n0") - - @mock.patch('functest.cli.commands.cli_os.os.path.isfile', - return_value=True) - @mock.patch('functest.cli.commands.cli_os.click.echo') - def test_clean(self, mock_click_echo, mock_os_path): - with mock.patch.object(self.cli_os, 'ping_endpoint'), \ - mock.patch('functest.cli.commands.cli_os.os_clean.main') \ - as mock_os_clean: - self.cli_os.clean() - self.assertTrue(mock_os_clean.called) - - @mock.patch('functest.cli.commands.cli_os.os.path.isfile', - return_value=False) - @mock.patch('functest.cli.commands.cli_os.click.echo') - def test_clean_missing_file(self, mock_click_echo, mock_os_path): - with mock.patch.object(self.cli_os, 'ping_endpoint'): - self.cli_os.clean() - mock_click_echo.assert_called_once_with("Not possible to clean " - "OpenStack without a " - "snapshot. This could " - "cause problems. " - "Run first the command " - "'functest openstack " - "snapshot-create'") - @mock.patch('functest.cli.commands.cli_os.click.echo') def test_show_credentials(self, mock_click_echo): key = 'OS_KEY' diff --git a/functest/tests/unit/cli/test_cli_base.py b/functest/tests/unit/cli/test_cli_base.py index 08c9b736..bc2ca903 100644 --- a/functest/tests/unit/cli/test_cli_base.py +++ b/functest/tests/unit/cli/test_cli_base.py @@ -35,26 +35,6 @@ class CliBaseTesting(unittest.TestCase): self.assertEqual(result.exit_code, 0) self.assertTrue(mock_method.called) - def test_os_snapshot_create(self): - with mock.patch.object(self._openstack, 'snapshot_create') \ - as mock_method: - result = self.runner.invoke(cli_base.os_snapshot_create) - self.assertEqual(result.exit_code, 0) - self.assertTrue(mock_method.called) - - def test_os_snapshot_show(self): - with mock.patch.object(self._openstack, 'snapshot_show') \ - as mock_method: - result = self.runner.invoke(cli_base.os_snapshot_show) - self.assertEqual(result.exit_code, 0) - self.assertTrue(mock_method.called) - - def test_os_clean(self): - with mock.patch.object(self._openstack, 'clean') as mock_method: - result = self.runner.invoke(cli_base.os_clean) - self.assertEqual(result.exit_code, 0) - self.assertTrue(mock_method.called) - def test_os_show_credentials(self): with mock.patch.object(self._openstack, 'show_credentials') \ as mock_method: |