Esempio n. 1
0
 def test_update_port_on_error(self, mock_check):
     core_plugin, context = mock.Mock(), mock.Mock()
     port = mock_check.return_value = {"device_owner": "xxxxxxxx"}
     revert_value = {"device_id": "", "device_owner": port["device_owner"]}
     with testtools.ExpectedException(ValueError):
         with utils.update_port_on_error(core_plugin, context, 1, revert_value):
             raise ValueError()
     core_plugin.update_port.assert_called_once_with(context, 1, {"port": revert_value})
Esempio n. 2
0
 def test_update_port_on_error(self, mock_check):
     core_plugin, context = mock.Mock(), mock.Mock()
     port = mock_check.return_value = {'device_owner': 'xxxxxxxx'}
     revert_value = {'device_id': '', 'device_owner': port['device_owner']}
     with testtools.ExpectedException(ValueError):
         with utils.update_port_on_error(core_plugin, context, 1,
                                         revert_value):
             raise ValueError()
     core_plugin.update_port.assert_called_once_with(
         context, 1, {'port': revert_value})
Esempio n. 3
0
 def test_update_port_on_error(self, mock_check):
     core_plugin, context = mock.Mock(), mock.Mock()
     port = mock_check.return_value = {'device_owner': 'xxxxxxxx'}
     revert_value = {'device_id': '', 'device_owner': port['device_owner']}
     with testtools.ExpectedException(ValueError):
         with utils.update_port_on_error(core_plugin,
                                         context, 1, revert_value):
             raise ValueError()
     core_plugin.update_port.assert_called_once_with(
         context, 1, {'port': revert_value})