diff options
| author | Huanxuan Ao <huanxuan.ao@easystack.cn> | 2017-03-08 10:01:16 +0800 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2017-04-26 11:07:08 -0500 |
| commit | 1c49a1f01da73b8eed701809de88b408e738dfed (patch) | |
| tree | decfdfb36d616d70d40e98b534ff93ea5390aecc /openstackclient/tests/unit/volume/v1 | |
| parent | bf1f47c1be5bf9f6b25eab21eb06c3b0473bf34f (diff) | |
| download | python-openstackclient-1c49a1f01da73b8eed701809de88b408e738dfed.tar.gz | |
Fix NoneType error for volume snapshot create command
In volume snapshot command, <volume> is the same
as <snapshot-name> when --volume is not specified,
but <volume> cannot be None, so when <snapshot-name>
is not specified (<snapshot-name> is None), a NoneType
error appears.
So make <snapshot-name> no longer optional, it should
be always present.
Change-Id: I3d9f10753a8ef601e70816421c160598e2cc811f
Closes-bug: #1659894
Diffstat (limited to 'openstackclient/tests/unit/volume/v1')
| -rw-r--r-- | openstackclient/tests/unit/volume/v1/test_snapshot.py | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/openstackclient/tests/unit/volume/v1/test_snapshot.py b/openstackclient/tests/unit/volume/v1/test_snapshot.py index 87a62b0a..70b55ce2 100644 --- a/openstackclient/tests/unit/volume/v1/test_snapshot.py +++ b/openstackclient/tests/unit/volume/v1/test_snapshot.py @@ -18,6 +18,7 @@ from mock import call from osc_lib import exceptions from osc_lib import utils +from openstackclient.tests.unit import utils as tests_utils from openstackclient.tests.unit.volume.v1 import fakes as volume_fakes from openstackclient.volume.v1 import volume_snapshot @@ -98,26 +99,17 @@ class TestSnapshotCreate(TestSnapshot): def test_snapshot_create_without_name(self): arglist = [ "--volume", self.new_snapshot.volume_id, - "--description", self.new_snapshot.display_description, - "--force" ] verifylist = [ ("volume", self.new_snapshot.volume_id), - ("description", self.new_snapshot.display_description), - ("force", True) ] - parsed_args = self.check_parser(self.cmd, arglist, verifylist) - - columns, data = self.cmd.take_action(parsed_args) - - self.snapshots_mock.create.assert_called_with( - self.new_snapshot.volume_id, - True, - None, - self.new_snapshot.display_description, + self.assertRaises( + tests_utils.ParserException, + self.check_parser, + self.cmd, + arglist, + verifylist, ) - self.assertEqual(self.columns, columns) - self.assertEqual(self.data, data) def test_snapshot_create_without_volume(self): arglist = [ |
