diff options
| author | Huanxuan Ao <huanxuan.ao@easystack.cn> | 2016-08-11 11:38:16 +0800 |
|---|---|---|
| committer | Huanxuan Ao <huanxuan.ao@easystack.cn> | 2016-08-11 11:43:03 +0800 |
| commit | 95f0e3dc366a94d7e47c5dc4178253c25b1aaa08 (patch) | |
| tree | b187f7c2acf8502a405590b02572367ccda3a013 | |
| parent | b3248fb0bdf52905b4c241d561f9e8738fc56eba (diff) | |
| download | python-openstackclient-95f0e3dc366a94d7e47c5dc4178253c25b1aaa08.tar.gz | |
Fix errors in volume set/unset image properties unit tests
These errors may caused by copy-paste, we should specify
a fake return value for get() method but not create() method.
Create() mothod will not called in set/unset command. After
specifing the return value of get(), we can use the fake volume
in the assert.
Change-Id: I1e0df4c28ece373168788c396e9082d565e36cc7
| -rw-r--r-- | openstackclient/tests/volume/v2/test_volume.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/openstackclient/tests/volume/v2/test_volume.py b/openstackclient/tests/volume/v2/test_volume.py index 1bb5c192..74181a25 100644 --- a/openstackclient/tests/volume/v2/test_volume.py +++ b/openstackclient/tests/volume/v2/test_volume.py @@ -841,7 +841,7 @@ class TestVolumeSet(TestVolume): # returns nothing self.cmd.take_action(parsed_args) self.volumes_mock.set_image_metadata.assert_called_with( - self.volumes_mock.get().id, parsed_args.image_property) + self.new_volume.id, parsed_args.image_property) def test_volume_set_state(self): arglist = [ @@ -919,7 +919,7 @@ class TestVolumeUnset(TestVolume): super(TestVolumeUnset, self).setUp() self.new_volume = volume_fakes.FakeVolume.create_one_volume() - self.volumes_mock.create.return_value = self.new_volume + self.volumes_mock.get.return_value = self.new_volume # Get the command object to set property self.cmd_set = volume.SetVolume(self.app, None) @@ -963,4 +963,4 @@ class TestVolumeUnset(TestVolume): self.cmd_unset.take_action(parsed_args_unset) self.volumes_mock.delete_image_metadata.assert_called_with( - self.volumes_mock.get().id, parsed_args_unset.image_property) + self.new_volume.id, parsed_args_unset.image_property) |
