def test_create_or_update_dhcp_options_failure_service_error( virtual_network_client, update_dhcp_options_patch, get_existing_resource_patch): error_message = 'Internal Server Error' module = get_module(dict(dhcp_id='ocid1.dhcpoptions..aa')) update_dhcp_options_patch.side_effect = ServiceError( 499, 'InternalServerError', dict(), error_message) try: oci_dhcp_options.create_or_update_dhcp_options(virtual_network_client, module) except Exception as ex: assert error_message in ex.args[0]
def test_create_or_update_dhcp_options_failure_timeout_error( virtual_network_client, update_dhcp_options_patch, get_existing_resource_patch): error_message = 'Timeout Error' module = get_module(dict(dhcp_id='ocid1.dhcpoptions..aa')) update_dhcp_options_patch.side_effect = MaximumWaitTimeExceeded( 400, 'TimeoutError', dict(), error_message) try: oci_dhcp_options.create_or_update_dhcp_options(virtual_network_client, module) except Exception as ex: assert error_message in ex.args[0].__repr__()
def test_create_or_update_dhcp_options_create(virtual_network_client, check_and_create_resource_patch): module = get_module(dict()) check_and_create_resource_patch.return_value = dict({'changed': True}) result = oci_dhcp_options.create_or_update_dhcp_options( virtual_network_client, module) assert result['changed'] is True
def test_create_or_update_dhcp_options_update(virtual_network_client, update_dhcp_options_patch, get_existing_resource_patch): module = get_module(dict(dhcp_id='ocid1.dhcpoptions..aa')) update_dhcp_options_patch.return_value = dict({'changed': True}) result = oci_dhcp_options.create_or_update_dhcp_options( virtual_network_client, module) assert result['changed'] is True