Beispiel #1
0
 def test_attach_to_instance_fail(self):
     vol = self.volume
     inst = fakes.FakeServer()
     mp = utils.random_unicode()
     vol._nova_volumes.create_server_volume = Mock(
         side_effect=Exception("test"))
     self.assertRaises(exc.VolumeAttachmentFailed, vol.attach_to_instance,
                       inst, mp)
Beispiel #2
0
 def test_client_attach_to_instance(self):
     clt = self.client
     vol = self.volume
     inst = fakes.FakeServer()
     mp = utils.random_unicode()
     vol.attach_to_instance = Mock()
     clt.attach_to_instance(vol, inst, mp)
     vol.attach_to_instance.assert_called_once_with(inst, mp)
Beispiel #3
0
 def test_attach_to_instance(self):
     vol = self.volume
     inst = fakes.FakeServer()
     mp = utils.random_unicode()
     vol._nova_volumes.create_server_volume = Mock(return_value=vol)
     vol.attach_to_instance(inst, mp)
     vol._nova_volumes.create_server_volume.assert_called_once_with(
         inst.id, vol.id, mp)