From 20b0b71809e7d9aaf82b07acac10f1d3f08c48a3 Mon Sep 17 00:00:00 2001 From: "zhiyong.dai" Date: Mon, 19 Dec 2016 18:50:08 +0800 Subject: [PATCH] Add one test for "backup set" command The former tests for "backup set" command miss a test for '--description' option. In this patch, one relative test is added. Change-Id: Ie755d56a68a666d48751ab1ad20c8edb50e69b94 --- .../tests/unit/volume/v2/test_backup.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/openstackclient/tests/unit/volume/v2/test_backup.py b/openstackclient/tests/unit/volume/v2/test_backup.py index 10e7aac5cf..a8e81c7eb8 100644 --- a/openstackclient/tests/unit/volume/v2/test_backup.py +++ b/openstackclient/tests/unit/volume/v2/test_backup.py @@ -418,6 +418,30 @@ class TestBackupSet(TestBackup): self.backup.id, **{'name': 'new_name'}) self.assertIsNone(result) + def test_backup_set_description(self): + arglist = [ + '--description', 'new_description', + self.backup.id, + ] + verifylist = [ + ('name', None), + ('description', 'new_description'), + ('backup', self.backup.id), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + result = self.cmd.take_action(parsed_args) + + # Set expected values + kwargs = { + 'description': 'new_description' + } + self.backups_mock.update.assert_called_once_with( + self.backup.id, + **kwargs + ) + self.assertIsNone(result) + def test_backup_set_state(self): arglist = [ '--state', 'error',