Ejemplo n.º 1
0
 def test_create_and_update_volume(self):
     volume_update_args = {"dispaly_name": "_updated"}
     scenario = volumes.CreateAndUpdateVolume(self.context)
     fake_volume = mock.MagicMock()
     scenario._create_volume = mock.MagicMock(return_value=fake_volume)
     scenario._update_volume = mock.MagicMock()
     scenario.run(1, update_volume_kwargs=volume_update_args)
     scenario._create_volume.assert_called_once_with(1)
     scenario._update_volume.assert_called_once_with(
         fake_volume, **volume_update_args)
Ejemplo n.º 2
0
 def test_create_and_update_volume(self, update_args, expected):
     mock_service = self.mock_cinder.return_value
     scenario = volumes.CreateAndUpdateVolume(self._get_context())
     scenario.generate_random_name = mock.MagicMock()
     scenario.generate_random_name.return_value = "new_name"
     scenario.run(1, update_volume_kwargs=update_args)
     mock_service.create_volume.assert_called_once_with(1)
     mock_service.update_volume.assert_called_once_with(
         mock_service.create_volume.return_value, **expected)
     if update_args.get("update_name", False):
         scenario.generate_random_name.assert_called_once_with()