def test_update_dhcp_options_options_changed(virtual_network_client, get_options_difference_patch, update_and_wait_patch): dhcp_dns_options = get_options('DomainNameServer', 'VcnLocalPlusInternet', [], None) dhcp_search_domain = get_options('SearchDomain', None, None, ['ansibletestvcn.oraclevcn.com']) options = [dhcp_dns_options, dhcp_search_domain] input_options = [{ "custom_dns_servers": [], "server_type": "VcnLocalPlusInternet", "type": "DomainNameServer" }, { "search_domain_names": ["ansibletestvcn.oraclevcn.com"], "type": "SearchDomain" }] module = get_module(dict(options=input_options, purge_dhcp_options=False)) dhcp_options = get_dhcp_options('ansible_dhcp_options', options) update_and_wait_patch.return_value = dict({ 'dhcp_options': dhcp_options, 'changed': True }) get_options_difference_patch.return_value = None, True oci_dhcp_options.update_dhcp_options(virtual_network_client, dhcp_options, module) assert update_and_wait_patch.called
def test_update_dhcp_options_no_dhcp_options_for_update(virtual_network_client): error_message = "No Dhcp Options" module = get_module(dict(dhcp_id="ocid1.dhcpoptions..xvdf")) try: oci_dhcp_options.update_dhcp_options(virtual_network_client, None, module) except Exception as ex: assert error_message in str(ex.args)
def test_update_dhcp_options_defined_tags_changed( virtual_network_client, update_and_wait_patch ): dhcp_options = get_dhcp_options("ansible_dhcp", None) module = get_module(dict(defined_tags=dict(dhcp_type=dict(choice="custom")))) update_and_wait_patch.return_value = dict( {"dhcp_options": to_dict(dhcp_options), "changed": True} ) oci_dhcp_options.update_dhcp_options(virtual_network_client, dhcp_options, module) assert update_and_wait_patch.called
def test_update_dhcp_options_freeform_tags_changed( virtual_network_client, update_and_wait_patch ): dhcp_options = get_dhcp_options("ansible_dhcp", None) module = get_module(dict(freeform_tags=dict(group="employee"))) update_and_wait_patch.return_value = dict( {"dhcp_options": to_dict(dhcp_options), "changed": True} ) oci_dhcp_options.update_dhcp_options(virtual_network_client, dhcp_options, module) assert update_and_wait_patch.called
def test_update_dhcp_options_name_changed(virtual_network_client, update_and_wait_patch): dhcp_options = get_dhcp_options('ansible_dhcp', None) module = get_module(dict()) update_and_wait_patch.return_value = dict({ 'dhcp_options': to_dict(dhcp_options), 'changed': True }) oci_dhcp_options.update_dhcp_options(virtual_network_client, dhcp_options, module) assert update_and_wait_patch.called
def test_update_dhcp_options_options_changed( virtual_network_client, update_and_wait_patch ): dhcp_dns_options = get_options("DomainNameServer", "VcnLocalPlusInternet", [], None) dhcp_search_domain = get_options( "SearchDomain", None, None, ["ansibletestvcn.oraclevcn.com"] ) options = [dhcp_dns_options, dhcp_search_domain] input_options = [ { "custom_dns_servers": [], "server_type": "VcnLocalPlusInternet", "type": "DomainNameServer", }, {"search_domain_names": ["ansibletestvcn.oracle.com"], "type": "SearchDomain"}, ] module = get_module(dict(options=input_options, purge_dhcp_options=False)) dhcp_options = get_dhcp_options("ansible_dhcp_options", options) update_and_wait_patch.return_value = dict( {"dhcp_options": dhcp_options, "changed": True} ) oci_dhcp_options.update_dhcp_options(virtual_network_client, dhcp_options, module) assert update_and_wait_patch.called