|
|
@@ -6,31 +6,31 @@ from unittest import mock
|
|
|
import ddt
|
|
|
from webob import exc
|
|
|
|
|
|
-from coriolis.api.v1 import replicas
|
|
|
+from coriolis.api.v1 import transfers
|
|
|
from coriolis.api.v1 import utils as api_utils
|
|
|
-from coriolis.api.v1.views import replica_tasks_execution_view
|
|
|
-from coriolis.api.v1.views import replica_view
|
|
|
+from coriolis.api.v1.views import transfer_tasks_execution_view
|
|
|
+from coriolis.api.v1.views import transfer_view
|
|
|
from coriolis.endpoints import api as endpoints_api
|
|
|
from coriolis import exception
|
|
|
-from coriolis.replicas import api
|
|
|
from coriolis.tests import test_base
|
|
|
from coriolis.tests import testutils
|
|
|
+from coriolis.transfers import api
|
|
|
|
|
|
|
|
|
@ddt.ddt
|
|
|
-class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
- """Test suite for the Coriolis Replica Controller v1 API"""
|
|
|
+class TransferControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
+ """Test suite for the Coriolis Transfer Controller v1 API"""
|
|
|
|
|
|
def setUp(self):
|
|
|
- super(ReplicaControllerTestCase, self).setUp()
|
|
|
- self.replicas = replicas.ReplicaController()
|
|
|
+ super(TransferControllerTestCase, self).setUp()
|
|
|
+ self.transfers = transfers.TransferController()
|
|
|
|
|
|
- @mock.patch('coriolis.api.v1.replicas.CONF')
|
|
|
- @mock.patch.object(replica_view, 'single')
|
|
|
- @mock.patch.object(api.API, 'get_replica')
|
|
|
+ @mock.patch('coriolis.api.v1.transfers.CONF')
|
|
|
+ @mock.patch.object(transfer_view, 'single')
|
|
|
+ @mock.patch.object(api.API, 'get_transfer')
|
|
|
def test_show(
|
|
|
self,
|
|
|
- mock_get_replica,
|
|
|
+ mock_get_transfer,
|
|
|
mock_single,
|
|
|
mock_conf
|
|
|
):
|
|
|
@@ -38,26 +38,26 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
mock_context = mock.Mock()
|
|
|
mock_req.environ = {'coriolis.context': mock_context}
|
|
|
id = mock.sentinel.id
|
|
|
- mock_conf.api.include_task_info_in_replicas_api = True
|
|
|
+ mock_conf.api.include_task_info_in_transfers_api = True
|
|
|
|
|
|
- result = self.replicas.show(mock_req, id)
|
|
|
+ result = self.transfers.show(mock_req, id)
|
|
|
|
|
|
self.assertEqual(
|
|
|
mock_single.return_value,
|
|
|
result
|
|
|
)
|
|
|
|
|
|
- mock_context.can.assert_called_once_with("migration:replicas:show")
|
|
|
- mock_get_replica.assert_called_once_with(
|
|
|
+ mock_context.can.assert_called_once_with("migration:transfers:show")
|
|
|
+ mock_get_transfer.assert_called_once_with(
|
|
|
mock_context, id, include_task_info=True)
|
|
|
- mock_single.assert_called_once_with(mock_get_replica.return_value)
|
|
|
+ mock_single.assert_called_once_with(mock_get_transfer.return_value)
|
|
|
|
|
|
- @mock.patch('coriolis.api.v1.replicas.CONF')
|
|
|
- @mock.patch.object(replica_view, 'single')
|
|
|
- @mock.patch.object(api.API, 'get_replica')
|
|
|
- def test_show_no_replica(
|
|
|
+ @mock.patch('coriolis.api.v1.transfers.CONF')
|
|
|
+ @mock.patch.object(transfer_view, 'single')
|
|
|
+ @mock.patch.object(api.API, 'get_transfer')
|
|
|
+ def test_show_no_transfer(
|
|
|
self,
|
|
|
- mock_get_replica,
|
|
|
+ mock_get_transfer,
|
|
|
mock_single,
|
|
|
mock_conf
|
|
|
):
|
|
|
@@ -65,29 +65,29 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
mock_context = mock.Mock()
|
|
|
mock_req.environ = {'coriolis.context': mock_context}
|
|
|
id = mock.sentinel.id
|
|
|
- mock_conf.api.include_task_info_in_replicas_api = True
|
|
|
- mock_get_replica.return_value = None
|
|
|
+ mock_conf.api.include_task_info_in_transfers_api = True
|
|
|
+ mock_get_transfer.return_value = None
|
|
|
|
|
|
self.assertRaises(
|
|
|
exc.HTTPNotFound,
|
|
|
- self.replicas.show,
|
|
|
+ self.transfers.show,
|
|
|
mock_req,
|
|
|
id
|
|
|
)
|
|
|
|
|
|
- mock_context.can.assert_called_once_with("migration:replicas:show")
|
|
|
- mock_get_replica.assert_called_once_with(
|
|
|
+ mock_context.can.assert_called_once_with("migration:transfers:show")
|
|
|
+ mock_get_transfer.assert_called_once_with(
|
|
|
mock_context, id, include_task_info=True)
|
|
|
mock_single.assert_not_called()
|
|
|
|
|
|
- @mock.patch('coriolis.api.v1.replicas.CONF')
|
|
|
- @mock.patch.object(replica_view, 'collection')
|
|
|
- @mock.patch.object(api.API, 'get_replicas')
|
|
|
+ @mock.patch('coriolis.api.v1.transfers.CONF')
|
|
|
+ @mock.patch.object(transfer_view, 'collection')
|
|
|
+ @mock.patch.object(api.API, 'get_transfers')
|
|
|
@mock.patch.object(api_utils, '_get_show_deleted')
|
|
|
def test_list(
|
|
|
self,
|
|
|
mock_get_show_deleted,
|
|
|
- mock_get_replicas,
|
|
|
+ mock_get_transfers,
|
|
|
mock_collection,
|
|
|
mock_conf
|
|
|
):
|
|
|
@@ -95,7 +95,7 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
mock_context = mock.Mock()
|
|
|
mock_req.environ = {'coriolis.context': mock_context}
|
|
|
|
|
|
- result = self.replicas._list(mock_req)
|
|
|
+ result = self.transfers._list(mock_req)
|
|
|
|
|
|
self.assertEqual(
|
|
|
mock_collection.return_value,
|
|
|
@@ -104,14 +104,15 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
|
|
|
mock_get_show_deleted.assert_called_once_with(
|
|
|
mock_req.GET.get.return_value)
|
|
|
- mock_context.can.assert_called_once_with("migration:replicas:list")
|
|
|
- mock_get_replicas.assert_called_once_with(
|
|
|
+ mock_context.can.assert_called_once_with("migration:transfers:list")
|
|
|
+ mock_get_transfers.assert_called_once_with(
|
|
|
mock_context,
|
|
|
include_tasks_executions=
|
|
|
- mock_conf.api.include_task_info_in_replicas_api,
|
|
|
- include_task_info=mock_conf.api.include_task_info_in_replicas_api
|
|
|
+ mock_conf.api.include_task_info_in_transfers_api,
|
|
|
+ include_task_info=mock_conf.api.include_task_info_in_transfers_api
|
|
|
)
|
|
|
- mock_collection.assert_called_once_with(mock_get_replicas.return_value)
|
|
|
+ mock_collection.assert_called_once_with(
|
|
|
+ mock_get_transfers.return_value)
|
|
|
|
|
|
@mock.patch.object(api_utils, 'validate_instances_list_for_transfer')
|
|
|
@mock.patch.object(endpoints_api.API, 'validate_source_environment')
|
|
|
@@ -120,7 +121,7 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
@mock.patch.object(api_utils, 'validate_user_scripts')
|
|
|
@mock.patch.object(api_utils, 'normalize_user_scripts')
|
|
|
@mock.patch.object(api_utils, 'validate_storage_mappings')
|
|
|
- @ddt.file_data('data/replicas_validate_create_body.yml')
|
|
|
+ @ddt.file_data('data/transfers_validate_create_body.yml')
|
|
|
def test_validate_create_body(
|
|
|
self,
|
|
|
mock_validate_storage_mappings,
|
|
|
@@ -136,15 +137,15 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
):
|
|
|
ctxt = {}
|
|
|
body = config["body"]
|
|
|
- replica = body["replica"]
|
|
|
- origin_endpoint_id = replica.get('origin_endpoint_id')
|
|
|
- source_environment = replica.get('source_environment')
|
|
|
- network_map = replica.get('network_map')
|
|
|
- destination_endpoint_id = replica.get('destination_endpoint_id')
|
|
|
- destination_environment = replica.get('destination_environment')
|
|
|
- user_scripts = replica.get('user_scripts')
|
|
|
- instances = replica.get('instances')
|
|
|
- storage_mappings = replica.get('storage_mappings')
|
|
|
+ transfer = body["transfer"]
|
|
|
+ origin_endpoint_id = transfer.get('origin_endpoint_id')
|
|
|
+ source_environment = transfer.get('source_environment')
|
|
|
+ network_map = transfer.get('network_map')
|
|
|
+ destination_endpoint_id = transfer.get('destination_endpoint_id')
|
|
|
+ destination_environment = transfer.get('destination_environment')
|
|
|
+ user_scripts = transfer.get('user_scripts')
|
|
|
+ instances = transfer.get('instances')
|
|
|
+ storage_mappings = transfer.get('storage_mappings')
|
|
|
mock_validate_instances_list_for_transfer.return_value = instances
|
|
|
mock_normalize_user_scripts.return_value = user_scripts
|
|
|
|
|
|
@@ -153,8 +154,8 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
Exception,
|
|
|
exception_raised,
|
|
|
testutils.get_wrapped_function(
|
|
|
- self.replicas._validate_create_body),
|
|
|
- self.replicas,
|
|
|
+ self.transfers._validate_create_body),
|
|
|
+ self.transfers,
|
|
|
ctxt,
|
|
|
body
|
|
|
)
|
|
|
@@ -162,8 +163,8 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
mock_validate_network_map.assert_not_called()
|
|
|
else:
|
|
|
result = testutils.get_wrapped_function(
|
|
|
- self.replicas._validate_create_body)(
|
|
|
- self.replicas,
|
|
|
+ self.transfers._validate_create_body)(
|
|
|
+ self.transfers,
|
|
|
ctxt,
|
|
|
body,
|
|
|
)
|
|
|
@@ -187,9 +188,9 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
mock_validate_instances_list_for_transfer.assert_called_once_with(
|
|
|
instances)
|
|
|
|
|
|
- @mock.patch.object(replica_view, 'single')
|
|
|
+ @mock.patch.object(transfer_view, 'single')
|
|
|
@mock.patch.object(api.API, 'create')
|
|
|
- @mock.patch.object(replicas.ReplicaController, '_validate_create_body')
|
|
|
+ @mock.patch.object(transfers.TransferController, '_validate_create_body')
|
|
|
def test_create(
|
|
|
self,
|
|
|
mock_validate_create_body,
|
|
|
@@ -202,7 +203,7 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
mock_body = {}
|
|
|
mock_validate_create_body.return_value = (mock.sentinel.value,) * 13
|
|
|
|
|
|
- result = self.replicas.create(mock_req, mock_body)
|
|
|
+ result = self.transfers.create(mock_req, mock_body)
|
|
|
|
|
|
self.assertEqual(
|
|
|
mock_single.return_value,
|
|
|
@@ -210,7 +211,7 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
)
|
|
|
|
|
|
mock_context.can.assert_called_once_with(
|
|
|
- "migration:replicas:create")
|
|
|
+ "migration:transfers:create")
|
|
|
mock_validate_create_body.assert_called_once_with(
|
|
|
mock_context, mock_body)
|
|
|
mock_create.assert_called_once()
|
|
|
@@ -228,7 +229,7 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
|
|
|
self.assertRaises(
|
|
|
exc.HTTPNoContent,
|
|
|
- self.replicas.delete,
|
|
|
+ self.transfers.delete,
|
|
|
mock_req,
|
|
|
id
|
|
|
)
|
|
|
@@ -248,15 +249,15 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
|
|
|
self.assertRaises(
|
|
|
exc.HTTPNotFound,
|
|
|
- self.replicas.delete,
|
|
|
+ self.transfers.delete,
|
|
|
mock_req,
|
|
|
id
|
|
|
)
|
|
|
|
|
|
- mock_context.can.assert_called_once_with("migration:replicas:delete")
|
|
|
+ mock_context.can.assert_called_once_with("migration:transfers:delete")
|
|
|
mock_delete.assert_called_once_with(mock_context, id)
|
|
|
|
|
|
- @ddt.file_data('data/replicas_update_storage_mappings.yml')
|
|
|
+ @ddt.file_data('data/transfers_update_storage_mappings.yml')
|
|
|
def test_update_storage_mappings(
|
|
|
self,
|
|
|
config,
|
|
|
@@ -267,11 +268,11 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
new_storage_mappings = config['new_storage_mappings']
|
|
|
|
|
|
if logs_expected:
|
|
|
- with self.assertLogs('coriolis.api.v1.replicas', level='INFO'):
|
|
|
- result = self.replicas._update_storage_mappings(
|
|
|
+ with self.assertLogs('coriolis.api.v1.transfers', level='INFO'):
|
|
|
+ result = self.transfers._update_storage_mappings(
|
|
|
original_storage_mappings, new_storage_mappings)
|
|
|
else:
|
|
|
- result = self.replicas._update_storage_mappings(
|
|
|
+ result = self.transfers._update_storage_mappings(
|
|
|
original_storage_mappings, new_storage_mappings)
|
|
|
|
|
|
self.assertEqual(
|
|
|
@@ -296,7 +297,7 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
"mock_global_scripts_2": "mock_value"},
|
|
|
'instances': {"mock_instance_scripts": "mock_new_value"}
|
|
|
}
|
|
|
- result = self.replicas._get_updated_user_scripts(
|
|
|
+ result = self.transfers._get_updated_user_scripts(
|
|
|
original_user_scripts, new_user_scripts)
|
|
|
|
|
|
self.assertEqual(
|
|
|
@@ -314,7 +315,7 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
}
|
|
|
new_user_scripts = {}
|
|
|
|
|
|
- result = self.replicas._get_updated_user_scripts(
|
|
|
+ result = self.transfers._get_updated_user_scripts(
|
|
|
original_user_scripts, new_user_scripts)
|
|
|
|
|
|
self.assertEqual(
|
|
|
@@ -322,11 +323,13 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
result
|
|
|
)
|
|
|
|
|
|
- @mock.patch.object(replicas.ReplicaController, '_get_updated_user_scripts')
|
|
|
+ @mock.patch.object(transfers.TransferController,
|
|
|
+ '_get_updated_user_scripts')
|
|
|
@mock.patch.object(api_utils, 'validate_user_scripts')
|
|
|
- @mock.patch.object(replicas.ReplicaController, '_update_storage_mappings')
|
|
|
- @ddt.file_data('data/replicas_get_merged_replica_values.yml')
|
|
|
- def test_get_merged_replica_values(
|
|
|
+ @mock.patch.object(transfers.TransferController,
|
|
|
+ '_update_storage_mappings')
|
|
|
+ @ddt.file_data('data/transfers_get_merged_transfer_values.yml')
|
|
|
+ def test_get_merged_transfer_values(
|
|
|
self,
|
|
|
mock_update_storage_mappings,
|
|
|
mock_validate_user_scripts,
|
|
|
@@ -334,10 +337,10 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
config,
|
|
|
expected_result
|
|
|
):
|
|
|
- replica = config['replica']
|
|
|
+ transfer = config['transfer']
|
|
|
updated_values = config['updated_values']
|
|
|
- original_storage_mapping = replica.get('storage_mappings', {})
|
|
|
- replica_user_scripts = replica.get('user_scripts', {})
|
|
|
+ original_storage_mapping = transfer.get('storage_mappings', {})
|
|
|
+ transfer_user_scripts = transfer.get('user_scripts', {})
|
|
|
updated_user_scripts = updated_values.get('user_scripts', {})
|
|
|
new_storage_mappings = updated_values.get('storage_mappings', {})
|
|
|
expected_result['storage_mappings'] = \
|
|
|
@@ -349,8 +352,8 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
mock_validate_user_scripts.side_effect = ["mock_scripts",
|
|
|
"mock_new_scripts"]
|
|
|
|
|
|
- result = self.replicas._get_merged_replica_values(
|
|
|
- replica, updated_values)
|
|
|
+ result = self.transfers._get_merged_transfer_values(
|
|
|
+ transfer, updated_values)
|
|
|
|
|
|
self.assertEqual(
|
|
|
expected_result,
|
|
|
@@ -360,7 +363,8 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
mock_update_storage_mappings.assert_called_once_with(
|
|
|
original_storage_mapping, new_storage_mappings)
|
|
|
mock_validate_user_scripts.assert_has_calls(
|
|
|
- [mock.call(replica_user_scripts), mock.call(updated_user_scripts)])
|
|
|
+ [mock.call(transfer_user_scripts),
|
|
|
+ mock.call(updated_user_scripts)])
|
|
|
mock_get_updated_user_scripts.assert_called_once_with(
|
|
|
"mock_scripts", "mock_new_scripts")
|
|
|
|
|
|
@@ -370,14 +374,14 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
@mock.patch.object(api_utils, 'validate_network_map')
|
|
|
@mock.patch.object(endpoints_api.API, 'validate_target_environment')
|
|
|
@mock.patch.object(endpoints_api.API, 'validate_source_environment')
|
|
|
- @mock.patch.object(replicas.ReplicaController,
|
|
|
- '_get_merged_replica_values')
|
|
|
- @mock.patch.object(api.API, 'get_replica')
|
|
|
- @ddt.file_data('data/replicas_validate_update_body.yml')
|
|
|
+ @mock.patch.object(transfers.TransferController,
|
|
|
+ '_get_merged_transfer_values')
|
|
|
+ @mock.patch.object(api.API, 'get_transfer')
|
|
|
+ @ddt.file_data('data/transfers_validate_update_body.yml')
|
|
|
def test_validate_update_body(
|
|
|
self,
|
|
|
- mock_get_replica,
|
|
|
- mock_get_merged_replica_values,
|
|
|
+ mock_get_transfer,
|
|
|
+ mock_get_merged_transfer_values,
|
|
|
mock_validate_source_environment,
|
|
|
mock_validate_target_environment,
|
|
|
mock_validate_network_map,
|
|
|
@@ -388,17 +392,18 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
expected_result
|
|
|
):
|
|
|
body = config['body']
|
|
|
- replica = config['replica']
|
|
|
- replica_body = body['replica']
|
|
|
+ transfer = config['transfer']
|
|
|
+ transfer_body = body['transfer']
|
|
|
context = mock.sentinel.context
|
|
|
id = mock.sentinel.id
|
|
|
- mock_get_replica.return_value = replica
|
|
|
- mock_get_merged_replica_values.return_value = replica_body
|
|
|
- mock_normalize_user_scripts.return_value = replica_body['user_scripts']
|
|
|
+ mock_get_transfer.return_value = transfer
|
|
|
+ mock_get_merged_transfer_values.return_value = transfer_body
|
|
|
+ mock_normalize_user_scripts.return_value = transfer_body[
|
|
|
+ 'user_scripts']
|
|
|
|
|
|
result = testutils.get_wrapped_function(
|
|
|
- self.replicas._validate_update_body)(
|
|
|
- self.replicas,
|
|
|
+ self.transfers._validate_update_body)(
|
|
|
+ self.transfers,
|
|
|
id,
|
|
|
context,
|
|
|
body
|
|
|
@@ -409,29 +414,29 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
result
|
|
|
)
|
|
|
|
|
|
- mock_get_replica.assert_called_once_with(context, id)
|
|
|
- mock_get_merged_replica_values.assert_called_once_with(
|
|
|
- replica, replica_body)
|
|
|
+ mock_get_transfer.assert_called_once_with(context, id)
|
|
|
+ mock_get_merged_transfer_values.assert_called_once_with(
|
|
|
+ transfer, transfer_body)
|
|
|
mock_validate_source_environment.assert_called_once_with(
|
|
|
- context, replica['origin_endpoint_id'],
|
|
|
- replica_body['source_environment'])
|
|
|
+ context, transfer['origin_endpoint_id'],
|
|
|
+ transfer_body['source_environment'])
|
|
|
mock_validate_target_environment.assert_called_once_with(
|
|
|
- context, replica['destination_endpoint_id'],
|
|
|
- replica_body['destination_environment'])
|
|
|
+ context, transfer['destination_endpoint_id'],
|
|
|
+ transfer_body['destination_environment'])
|
|
|
mock_validate_network_map.assert_called_once_with(
|
|
|
- replica_body['network_map'])
|
|
|
+ transfer_body['network_map'])
|
|
|
mock_validate_storage_mappings.assert_called_once_with(
|
|
|
- replica_body['storage_mappings'])
|
|
|
+ transfer_body['storage_mappings'])
|
|
|
mock_validate_user_scripts.assert_called_once_with(
|
|
|
- replica_body['user_scripts'])
|
|
|
+ transfer_body['user_scripts'])
|
|
|
mock_normalize_user_scripts.assert_called_once_with(
|
|
|
- replica_body['user_scripts'], replica['instances'])
|
|
|
+ transfer_body['user_scripts'], transfer['instances'])
|
|
|
|
|
|
- @mock.patch.object(api.API, 'get_replica')
|
|
|
- @ddt.file_data('data/replicas_validate_update_body_raises.yml')
|
|
|
+ @mock.patch.object(api.API, 'get_transfer')
|
|
|
+ @ddt.file_data('data/transfers_validate_update_body_raises.yml')
|
|
|
def test_validate_update_body_raises(
|
|
|
self,
|
|
|
- mock_get_replica,
|
|
|
+ mock_get_transfer,
|
|
|
body,
|
|
|
):
|
|
|
context = mock.sentinel.context
|
|
|
@@ -440,18 +445,18 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
self.assertRaises(
|
|
|
exc.HTTPBadRequest,
|
|
|
testutils.get_wrapped_function(
|
|
|
- self.replicas._validate_update_body),
|
|
|
- self.replicas,
|
|
|
+ self.transfers._validate_update_body),
|
|
|
+ self.transfers,
|
|
|
id,
|
|
|
context,
|
|
|
body
|
|
|
)
|
|
|
|
|
|
- mock_get_replica.assert_called_once_with(context, id)
|
|
|
+ mock_get_transfer.assert_called_once_with(context, id)
|
|
|
|
|
|
- @mock.patch.object(replica_tasks_execution_view, 'single')
|
|
|
+ @mock.patch.object(transfer_tasks_execution_view, 'single')
|
|
|
@mock.patch.object(api.API, 'update')
|
|
|
- @mock.patch.object(replicas.ReplicaController, '_validate_update_body')
|
|
|
+ @mock.patch.object(transfers.TransferController, '_validate_update_body')
|
|
|
def test_update(
|
|
|
self,
|
|
|
mock_validate_update_body,
|
|
|
@@ -464,7 +469,7 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
id = mock.sentinel.id
|
|
|
body = mock.sentinel.body
|
|
|
|
|
|
- result = self.replicas.update(mock_req, id, body)
|
|
|
+ result = self.transfers.update(mock_req, id, body)
|
|
|
|
|
|
self.assertEqual(
|
|
|
mock_single.return_value,
|
|
|
@@ -472,7 +477,7 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
)
|
|
|
|
|
|
mock_context.can.assert_called_once_with(
|
|
|
- "migration:replicas:update")
|
|
|
+ "migration:transfers:update")
|
|
|
mock_validate_update_body.assert_called_once_with(
|
|
|
id, mock_context, body)
|
|
|
mock_update.assert_called_once_with(
|
|
|
@@ -481,7 +486,7 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
mock_single.assert_called_once_with(mock_update.return_value)
|
|
|
|
|
|
@mock.patch.object(api.API, 'update')
|
|
|
- @mock.patch.object(replicas.ReplicaController, '_validate_update_body')
|
|
|
+ @mock.patch.object(transfers.TransferController, '_validate_update_body')
|
|
|
def test_update_not_found(
|
|
|
self,
|
|
|
mock_validate_update_body,
|
|
|
@@ -496,14 +501,14 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
|
|
|
self.assertRaises(
|
|
|
exc.HTTPNotFound,
|
|
|
- self.replicas.update,
|
|
|
+ self.transfers.update,
|
|
|
mock_req,
|
|
|
id,
|
|
|
body
|
|
|
)
|
|
|
|
|
|
mock_context.can.assert_called_once_with(
|
|
|
- "migration:replicas:update")
|
|
|
+ "migration:transfers:update")
|
|
|
mock_validate_update_body.assert_called_once_with(
|
|
|
id, mock_context, body)
|
|
|
mock_update.assert_called_once_with(
|
|
|
@@ -511,7 +516,7 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
mock_validate_update_body.return_value)
|
|
|
|
|
|
@mock.patch.object(api.API, 'update')
|
|
|
- @mock.patch.object(replicas.ReplicaController, '_validate_update_body')
|
|
|
+ @mock.patch.object(transfers.TransferController, '_validate_update_body')
|
|
|
def test_update_not_invalid_parameter_value(
|
|
|
self,
|
|
|
mock_validate_update_body,
|
|
|
@@ -526,14 +531,14 @@ class ReplicaControllerTestCase(test_base.CoriolisBaseTestCase):
|
|
|
|
|
|
self.assertRaises(
|
|
|
exc.HTTPNotFound,
|
|
|
- self.replicas.update,
|
|
|
+ self.transfers.update,
|
|
|
mock_req,
|
|
|
id,
|
|
|
body
|
|
|
)
|
|
|
|
|
|
mock_context.can.assert_called_once_with(
|
|
|
- "migration:replicas:update")
|
|
|
+ "migration:transfers:update")
|
|
|
mock_validate_update_body.assert_called_once_with(
|
|
|
id, mock_context, body)
|
|
|
mock_update.assert_called_once_with(
|