def test_create_or_update_route_service_error(virtual_network_client, check_and_create_resource_patch): error_message = 'Internal Server Error' module = get_module(None) check_and_create_resource_patch.side_effect = ServiceError( 499, 'InternalServerError', dict(), error_message) try: oci_route_table.create_or_update_route_table(virtual_network_client, module) except Exception as ex: assert error_message in ex.args[0]
def test_create_or_update_route_timeout_error(virtual_network_client, check_and_create_resource_patch): error_message = 'Time Out Error' module = get_module(None) check_and_create_resource_patch.side_effect = MaximumWaitTimeExceeded( 499, 'TimeoutError', dict(), error_message) try: oci_route_table.create_or_update_route_table(virtual_network_client, module) except Exception as ex: assert error_message in ex.args[0].__repr__()
def test_create_or_update_route_table_create(virtual_network_client, check_and_create_resource_patch): route_table = get_route_table() module = get_module(None) check_and_create_resource_patch.return_value = dict( changed=True, route_table=route_table) result = oci_route_table.create_or_update_route_table( virtual_network_client, module) assert result['changed'] is True
def test_create_or_update_route_table_update(virtual_network_client, update_route_table_patch, get_existing_resource_patch): route_table = get_route_table() module = get_module(dict({'rt_id': 'ocid1.routetable..xvfd'})) update_route_table_patch.return_value = dict(changed=True, route_table=route_table) result = oci_route_table.create_or_update_route_table( virtual_network_client, module) assert result['changed'] is True