From 7f2f2f2ae359e6e314e2c3bafcbf559240847768 Mon Sep 17 00:00:00 2001 From: matthewdennett <52452990+matthewdennett@users.noreply.github.com> Date: Mon, 8 May 2023 22:04:47 +1000 Subject: [PATCH 01/10] Attributes (#4) * Add extensible attribute module * added choices to IB_spec * doco * Add the struct creation to api * doco * pep and lint --- plugins/module_utils/api.py | 10 + plugins/modules/nios_extensible_attribute.py | 201 +++++++++++++++++++ 2 files changed, 211 insertions(+) create mode 100644 plugins/modules/nios_extensible_attribute.py diff --git a/plugins/module_utils/api.py b/plugins/module_utils/api.py index 3a586193..99812bd0 100644 --- a/plugins/module_utils/api.py +++ b/plugins/module_utils/api.py @@ -78,6 +78,7 @@ NIOS_DTC_MONITOR_SNMP = 'dtc:monitor:snmp' NIOS_DTC_MONITOR_TCP = 'dtc:monitor:tcp' NIOS_DTC_TOPOLOGY = 'dtc:topology' +NIOS_EXTENSIBLE_ATTRIBUTE = 'extensibleattributedef' NIOS_PROVIDER_SPEC = { 'host': dict(fallback=(env_fallback, ['INFOBLOX_HOST'])), @@ -213,6 +214,12 @@ def convert_members_to_struct(member_spec): member_spec['members'] = [{'_struct': 'dhcpmember', 'name': k['name']} for k in member_spec['members']] return member_spec +def convert_ea_list_to_struct(member_spec): + ''' Transforms the list of the values into a valid WAPI struct. + ''' + if 'list_values' in member_spec.keys(): + member_spec['list_values'] = [{'_struct': 'extensibleattributedef:listvalues', 'value': v} for v in member_spec['list_values']] + return member_spec def normalize_ib_spec(ib_spec): result = {} @@ -381,6 +388,9 @@ def run(self, ib_obj_type, ib_spec): proposed_object['end_addr'] = proposed_object.get('new_end_addr') del proposed_object['new_end_addr'] + if (ib_obj_type == NIOS_EXTENSIBLE_ATTRIBUTE): + proposed_object = convert_ea_list_to_struct(proposed_object) + # checks if the 'text' field has to be updated for the TXT Record if (ib_obj_type == NIOS_TXT_RECORD): text_obj = proposed_object["text"] diff --git a/plugins/modules/nios_extensible_attribute.py b/plugins/modules/nios_extensible_attribute.py new file mode 100644 index 00000000..71fbce03 --- /dev/null +++ b/plugins/modules/nios_extensible_attribute.py @@ -0,0 +1,201 @@ +#!/usr/bin/python +# Copyright (c) 2018-2019 Red Hat, Inc. +# Copyright (c) 2020 Infoblox, Inc. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: nios_extensible_attribute +author: "Matthew Dennett (@matthewdennett)" +short_description: Configure Infoblox NIOS extensible attribute definition +version_added: "1.5.0" +description: + - Adds and/or removes a extensible attribute definition objects from + Infoblox NIOS servers. This module manages NIOS C(extensibleattributedef) + objects using the Infoblox WAPI interface over REST. +requirements: + - infoblox-client +extends_documentation_fragment: infoblox.nios_modules.nios +notes: + - This module supports C(check_mode). +options: + comment: + description: + - Configures a text string comment to be associated with the instance + of this object. The provided text string will be configured on the + object instance. + type: str + default_value: + description: + - Configures the default value which is pre populated in the GUI when + this attribute is used. Email, URL and string types the value is a + with a maximum of 256 characters. + type: str + list_values: + description: + - Configures a list of preset values associated with the instance of this + object. Only applicable when the attribute type is set to ENUM. + type: list + elements: str + max: + description: + - Configures the maximum value to be associated with the instance of + this object. When provided for an extensible attribute of type + STRING the value represents the maximum number of characters the string + can contain. When provided for an extensible attribute of type INTEGER + the value represents the maximum integer value permitted.Not + applicable for other attributes types. + type: str + min: + description: + - Configures the minimum value to be associated with the instance of + this object. When provided for an extensible attribute of type + STRING the value represents the minimum number of characters the string + can contain. When provided for an extensible attribute of type INTEGER + the value represents the minimum integer value permitted. Not + applicable for other attributes types. + type: str + name: + description: + - Configures the intended name of the instance of the object on the + NIOS server. + type: str + required: true + type: + description: + - Configures the intended type for this attribute object definition + on the NIOS server. + type: str + default: STRING + choices: + - DATE + - EMAIL + - ENUM + - INTEGER + - STRING + - URL + state: + description: + - Configures the intended state of the instance of the object on + the NIOS server. When this value is set to C(present), the object + is configured on the device and when this value is set to C(absent) + the value is removed (if necessary) from the device. + type: str + default: present + choices: + - present + - absent +''' + +EXAMPLES = ''' +- name: Configure an extensible attribute + infoblox.nios_modules.nios_extensible_attribute: + name: my_string + type: STRING + comment: Created by ansible + state: present + provider: + host: "{{ inventory_hostname_short }}" + username: admin + password: admin + connection: local + +- name: Remove a extensible attribute + infoblox.nios_modules.nios_extensible_attribute: + name: my_string + type: INTEGER + state: absent + provider: + host: "{{ inventory_hostname_short }}" + username: admin + password: admin + connection: local + +- name: Create INT extensible attribute + infoblox.nios_modules.nios_extensible_attribute: + name: my_int + type: INTEGER + comment: Created by ansible + min: 10 + max: 20 + state: present + provider: + host: "{{ inventory_hostname_short }}" + username: admin + password: admin + connection: local + +- name: Update an extensible attribute + infoblox.nios_modules.nios_extensible_attribute: + name: my_int + type: INTEGER + comment: Updated by ansible + state: present + provider: + host: "{{ inventory_hostname_short }}" + username: admin + password: admin + connection: local + +- name: Create an list extensible attribute + infoblox.nios_modules.nios_extensible_attribute: + name: my_list + type: ENUM + state: present + list_values: + - one + - two + - three + provider: + host: "{{ inventory_hostname_short }}" + username: admin + password: admin + connection: local + +''' + +RETURN = ''' # ''' + +from ansible.module_utils.basic import AnsibleModule +from ..module_utils.api import WapiModule +from ..module_utils.api import normalize_ib_spec + + +def main(): + ''' Main entry point for module execution + ''' + + ib_spec = dict( + comment=dict(type='str'), + default_value=dict(type='str'), + list_values=dict(type='list', elements='str'), + max=dict(type='str'), + min=dict(type='str'), + name=dict(type='str', required=True, ib_req=True), + type=dict(type='str', default='STRING', + choices=['DATE', 'EMAIL', 'ENUM', 'INTEGER', 'STRING', 'URL']) + ) + + argument_spec = dict( + provider=dict(required=True), + state=dict(default='present', choices=['present', 'absent']) + ) + + argument_spec.update(normalize_ib_spec(ib_spec)) + argument_spec.update(WapiModule.provider_spec) + + module = AnsibleModule(argument_spec=argument_spec, + supports_check_mode=True) + + wapi = WapiModule(module) + + result = wapi.run('extensibleattributedef', ib_spec) + + module.exit_json(**result) + + +if __name__ == '__main__': + main() From bad10ca1b9922cf1ecde997ba4fa34838cf881d4 Mon Sep 17 00:00:00 2001 From: matt Date: Wed, 29 May 2024 20:43:26 +1000 Subject: [PATCH 02/10] fix pep issues --- plugins/module_utils/api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/module_utils/api.py b/plugins/module_utils/api.py index 99812bd0..a6303369 100644 --- a/plugins/module_utils/api.py +++ b/plugins/module_utils/api.py @@ -214,6 +214,7 @@ def convert_members_to_struct(member_spec): member_spec['members'] = [{'_struct': 'dhcpmember', 'name': k['name']} for k in member_spec['members']] return member_spec + def convert_ea_list_to_struct(member_spec): ''' Transforms the list of the values into a valid WAPI struct. ''' @@ -221,6 +222,7 @@ def convert_ea_list_to_struct(member_spec): member_spec['list_values'] = [{'_struct': 'extensibleattributedef:listvalues', 'value': v} for v in member_spec['list_values']] return member_spec + def normalize_ib_spec(ib_spec): result = {} for arg in ib_spec: From 54bacf40304a9274ac1fa9c3bab8dccd1c734854 Mon Sep 17 00:00:00 2001 From: matthewdennett <52452990+matthewdennett@users.noreply.github.com> Date: Wed, 29 May 2024 21:20:19 +1000 Subject: [PATCH 03/10] Add flags for extensible attributes (#5) (#6) * Extensible attributes module - support flags infobloxopen/infoblox-ansible/#186 add support for flags to the extensible attributes module * Extensible attributes - fix linting reported by the ansible sanity tests --------- Co-authored-by: Hugues Malphettes --- plugins/modules/nios_extensible_attribute.py | 22 ++++++++++++++++++++ tests/unit/compat/mock.py | 6 ++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/plugins/modules/nios_extensible_attribute.py b/plugins/modules/nios_extensible_attribute.py index 71fbce03..442e4ab3 100644 --- a/plugins/modules/nios_extensible_attribute.py +++ b/plugins/modules/nios_extensible_attribute.py @@ -77,6 +77,15 @@ - INTEGER - STRING - URL + flags: + description: + - This field contains extensible attribute flags. + Possible values: (A)udited, (C)loud API, Cloud (G)master, (I)nheritable, (L)isted, (M)andatory value, + MGM (P)rivate, (R)ead Only, (S)ort enum values, Multiple (V)alues. + If there are two or more flags in the field, you must list them according to the order they are listed above. + For example, "CR" is a valid value for the "flags" field because C = Cloud API is listed before R = Read only. + However, the value "RC" is invalid because the order for the "flags" field is broken. + type: str state: description: - Configures the intended state of the instance of the object on @@ -103,6 +112,18 @@ password: admin connection: local +- name: Update an extensible attribute to accept multiple values + infoblox.nios_modules.nios_extensible_attribute: + name: my_string + type: STRING + flags: V + state: present + provider: + host: "{{ inventory_hostname_short }}" + username: admin + password: admin + connection: local + - name: Remove a extensible attribute infoblox.nios_modules.nios_extensible_attribute: name: my_string @@ -174,6 +195,7 @@ def main(): list_values=dict(type='list', elements='str'), max=dict(type='str'), min=dict(type='str'), + flags=dict(type='str'), name=dict(type='str', required=True, ib_req=True), type=dict(type='str', default='STRING', choices=['DATE', 'EMAIL', 'ENUM', 'INTEGER', 'STRING', 'URL']) diff --git a/tests/unit/compat/mock.py b/tests/unit/compat/mock.py index ba8455bf..802cf61e 100644 --- a/tests/unit/compat/mock.py +++ b/tests/unit/compat/mock.py @@ -64,8 +64,7 @@ def _iterate_read_data(read_data): # newline that our naive format() added data_as_list[-1] = data_as_list[-1][:-1] - for line in data_as_list: - yield line + yield from data_as_list def mock_open(mock=None, read_data=''): """ @@ -91,8 +90,7 @@ def _readline_side_effect(): if handle.readline.return_value is not None: while True: yield handle.readline.return_value - for line in _data: - yield line + yield from _data global file_spec if file_spec is None: From 94d2928cd7ac6a8b2051478c6bb61267bc8f90eb Mon Sep 17 00:00:00 2001 From: matt Date: Wed, 29 May 2024 21:28:34 +1000 Subject: [PATCH 04/10] Documentation update fix doco line length fix line length PEP issue pep issue --- plugins/lookup/nios_next_ip.py | 8 +++++--- plugins/modules/nios_extensible_attribute.py | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/lookup/nios_next_ip.py b/plugins/lookup/nios_next_ip.py index e2fa076d..d084ad4f 100644 --- a/plugins/lookup/nios_next_ip.py +++ b/plugins/lookup/nios_next_ip.py @@ -43,11 +43,12 @@ EXAMPLES = """ - name: return next available IP address for network 192.168.10.0/24 ansible.builtin.set_fact: - ipaddr: "{{ lookup('infoblox.nios_modules.nios_next_ip', '192.168.10.0/24', provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}" + ipaddr: "{{ lookup('infoblox.nios_modules.nios_next_ip', '192.168.10.0/24', + provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}" - name: return next available IP address for network 192.168.10.0/24 in a non-default network view ansible.builtin.set_fact: - ipaddr: "{{ lookup('infoblox.nios_modules.nios_next_ip', '192.168.10.0/24', network_view='ansible', \ + ipaddr: "{{ lookup('infoblox.nios_modules.nios_next_ip', '192.168.10.0/24', network_view='ansible', provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}" - name: return the next 3 available IP addresses for network 192.168.10.0/24 @@ -62,7 +63,8 @@ - name: return next available IP address for network fd30:f52:2:12::/64 ansible.builtin.set_fact: - ipaddr: "{{ lookup('infoblox.nios_modules.nios_next_ip', 'fd30:f52:2:12::/64', provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}" + ipaddr: "{{ lookup('infoblox.nios_modules.nios_next_ip', 'fd30:f52:2:12::/64', + provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}" """ RETURN = """ diff --git a/plugins/modules/nios_extensible_attribute.py b/plugins/modules/nios_extensible_attribute.py index 442e4ab3..2d8f5884 100644 --- a/plugins/modules/nios_extensible_attribute.py +++ b/plugins/modules/nios_extensible_attribute.py @@ -9,9 +9,11 @@ DOCUMENTATION = ''' --- module: nios_extensible_attribute -author: "Matthew Dennett (@matthewdennett)" +author: + - "Matthew Dennett (@matthewdennett)" + - "Hugues Malphettes (@hmalphettes)" short_description: Configure Infoblox NIOS extensible attribute definition -version_added: "1.5.0" +version_added: "1.7.0" description: - Adds and/or removes a extensible attribute definition objects from Infoblox NIOS servers. This module manages NIOS C(extensibleattributedef) @@ -80,7 +82,7 @@ flags: description: - This field contains extensible attribute flags. - Possible values: (A)udited, (C)loud API, Cloud (G)master, (I)nheritable, (L)isted, (M)andatory value, + The possible values are (A)udited, (C)loud API, Cloud (G)master, (I)nheritable, (L)isted, (M)andatory value, MGM (P)rivate, (R)ead Only, (S)ort enum values, Multiple (V)alues. If there are two or more flags in the field, you must list them according to the order they are listed above. For example, "CR" is a valid value for the "flags" field because C = Cloud API is listed before R = Read only. From 2def79e11f0090e900375f9cba84f9fb34c38a77 Mon Sep 17 00:00:00 2001 From: jkhatri Date: Thu, 27 Jun 2024 01:52:33 -0700 Subject: [PATCH 05/10] [FIX] CI execution for unit test --- .github/workflows/ansible-test.yml | 2 ++ tests/unit/requirements.txt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 0d14379b..eade26c6 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -51,6 +51,8 @@ jobs: python-version: ['3.8', '3.9', '3.10', '3.11'] ansible-version: [stable-2.14, stable-2.15, stable-2.16, devel] exclude: + - ansible-version: devel + python-version: '3.10' - ansible-version: devel python-version: '3.8' - ansible-version: devel diff --git a/tests/unit/requirements.txt b/tests/unit/requirements.txt index fc67ca9e..e2aefbb4 100644 --- a/tests/unit/requirements.txt +++ b/tests/unit/requirements.txt @@ -5,5 +5,5 @@ pytest-xdist mock pytest-mock pytest-cov -coverage==7.3.2 +coverage From 705ada2c8f0aadc1df8f0862af6dced692299cb5 Mon Sep 17 00:00:00 2001 From: jkhatri Date: Thu, 27 Jun 2024 02:23:11 -0700 Subject: [PATCH 06/10] Updated workflow file to support ansible-stable 2.17 and removed 2.14 --- .github/workflows/ansible-test.yml | 34 ++++++++++++++---------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index eade26c6..474080af 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -48,23 +48,21 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] - ansible-version: [stable-2.14, stable-2.15, stable-2.16, devel] + python-version: ['3.9', '3.10', '3.11', '3.12'] + ansible-version: [stable-2.15, stable-2.16, stable-2.17, devel] exclude: - ansible-version: devel - python-version: '3.10' + python-version: '3.11' - ansible-version: devel - python-version: '3.8' + python-version: '3.10' - ansible-version: devel python-version: '3.9' - - ansible-version: stable-2.16 - python-version: '3.8' + - ansible-version: stable-2.17 + python-version: '3.9' - ansible-version: stable-2.16 python-version: '3.9' - ansible-version: stable-2.15 - python-version: '3.8' - - ansible-version: stable-2.14 - python-version: '3.8' + python-version: '3.12' steps: - name: Set up Python ${{ matrix.python-version }} @@ -116,21 +114,21 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] - ansible-version: [stable-2.14, stable-2.15, stable-2.16, devel] + python-version: ['3.9', '3.10', '3.11', '3.12'] + ansible-version: [stable-2.15, stable-2.16, stable-2.17, devel] exclude: - ansible-version: devel - python-version: '3.8' + python-version: '3.11' + - ansible-version: devel + python-version: '3.10' - ansible-version: devel python-version: '3.9' - - ansible-version: stable-2.16 - python-version: '3.8' + - ansible-version: stable-2.17 + python-version: '3.9' - ansible-version: stable-2.16 python-version: '3.9' - ansible-version: stable-2.15 - python-version: '3.8' - - ansible-version: stable-2.14 - python-version: '3.8' + python-version: '3.12' steps: - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v1 @@ -188,7 +186,7 @@ jobs: strategy: fail-fast: false matrix: - ansible-version: [stable-2.14, stable-2.15, stable-2.16, devel] + ansible-version: [stable-2.15, stable-2.16, stable-2.17, devel] steps: - name: Set up Python 3.10 From a4102ca01a5b569139c76782fd102a16772d4c30 Mon Sep 17 00:00:00 2001 From: jkhatri Date: Thu, 27 Jun 2024 02:41:41 -0700 Subject: [PATCH 07/10] [FIX] coverage report for stable-2.16 --- .github/workflows/ansible-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 474080af..da2e4aec 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -93,8 +93,8 @@ jobs: - name: Generate coverage report run: | - if [ "${{ matrix.ansible-version }}" == "stable-2.14" ]; then - pip install coverage==6.5.0; + if [ "${{ matrix.ansible-version }}" == "stable-2.16" ]; then + pip install coverage==7.3.2; elif [ "${{ matrix.ansible-version }}" == "stable-2.15" ]; then pip install coverage==6.5.0; fi From b7e5de89f7598cb2b17d4cf40c39a8b9b2d94ac7 Mon Sep 17 00:00:00 2001 From: Jeenitkumar Khatri Date: Fri, 28 Jun 2024 16:50:14 +0530 Subject: [PATCH 08/10] [FIX] changed called_once_with to assert_called_once_with for unit tests --- tests/unit/plugins/module_utils/test_api.py | 4 ++-- tests/unit/plugins/modules/test_nios_a_record.py | 2 +- tests/unit/plugins/modules/test_nios_aaaa_record.py | 2 +- tests/unit/plugins/modules/test_nios_host_record.py | 4 ++-- tests/unit/plugins/modules/test_nios_network_view.py | 4 ++-- tests/unit/plugins/modules/test_nios_nsgroup.py | 2 +- tests/unit/plugins/modules/test_nios_ptr_record.py | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/unit/plugins/module_utils/test_api.py b/tests/unit/plugins/module_utils/test_api.py index 18d02faf..6ebf5bad 100644 --- a/tests/unit/plugins/module_utils/test_api.py +++ b/tests/unit/plugins/module_utils/test_api.py @@ -99,7 +99,7 @@ def test_wapi_change(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.called_once_with(test_object) + wapi.update_object.assert_called_once_with(test_object) def test_wapi_change_false(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'default', @@ -125,7 +125,7 @@ def test_wapi_change_false(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.called_once_with(test_object) + wapi.update_object.assert_called_once_with(test_object) def test_wapi_extattrs_change(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'default', diff --git a/tests/unit/plugins/modules/test_nios_a_record.py b/tests/unit/plugins/modules/test_nios_a_record.py index 16d81866..e0aaf923 100644 --- a/tests/unit/plugins/modules/test_nios_a_record.py +++ b/tests/unit/plugins/modules/test_nios_a_record.py @@ -159,4 +159,4 @@ def test_nios_a_record_update_record_name(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.called_once_with(test_object) + wapi.update_object.assert_called_once_with(test_object) diff --git a/tests/unit/plugins/modules/test_nios_aaaa_record.py b/tests/unit/plugins/modules/test_nios_aaaa_record.py index 1b4f96c0..c53797a3 100644 --- a/tests/unit/plugins/modules/test_nios_aaaa_record.py +++ b/tests/unit/plugins/modules/test_nios_aaaa_record.py @@ -159,4 +159,4 @@ def test_nios_aaaa_record_update_record_name(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.called_once_with(test_object) + wapi.update_object.assert_called_once_with(test_object) diff --git a/tests/unit/plugins/modules/test_nios_host_record.py b/tests/unit/plugins/modules/test_nios_host_record.py index 8a5a8e6f..6dc292ec 100644 --- a/tests/unit/plugins/modules/test_nios_host_record.py +++ b/tests/unit/plugins/modules/test_nios_host_record.py @@ -126,7 +126,7 @@ def test_nios_host_record_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.called_once_with(test_object) + wapi.update_object.assert_called_once_with(test_object) def test_nios_host_record_update_record_name(self): self.module.params = {'provider': None, 'state': 'present', 'name': {'new_name': 'default', 'old_name': 'old_default'}, @@ -152,4 +152,4 @@ def test_nios_host_record_update_record_name(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.called_once_with(test_object) + wapi.update_object.assert_called_once_with(test_object) diff --git a/tests/unit/plugins/modules/test_nios_network_view.py b/tests/unit/plugins/modules/test_nios_network_view.py index fc95f180..b768297e 100644 --- a/tests/unit/plugins/modules/test_nios_network_view.py +++ b/tests/unit/plugins/modules/test_nios_network_view.py @@ -104,7 +104,7 @@ def test_nios_network_view_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.called_once_with(test_object) + wapi.update_object.assert_called_once_with(test_object) def test_nios_network_view_update_name(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'default', 'old_name': 'old_default', @@ -131,7 +131,7 @@ def test_nios_network_view_update_name(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.called_once_with(test_object) + wapi.update_object.assert_called_once_with(test_object) def test_nios_network_view_remove(self): self.module.params = {'provider': None, 'state': 'absent', 'name': 'ansible', diff --git a/tests/unit/plugins/modules/test_nios_nsgroup.py b/tests/unit/plugins/modules/test_nios_nsgroup.py index 60b21dcc..a99c6ec1 100644 --- a/tests/unit/plugins/modules/test_nios_nsgroup.py +++ b/tests/unit/plugins/modules/test_nios_nsgroup.py @@ -126,4 +126,4 @@ def test_nios_nsgroup_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.called_once_with(test_object) + wapi.update_object.assert_called_once_with(test_object) diff --git a/tests/unit/plugins/modules/test_nios_ptr_record.py b/tests/unit/plugins/modules/test_nios_ptr_record.py index 5ffd6487..67a9d5d8 100644 --- a/tests/unit/plugins/modules/test_nios_ptr_record.py +++ b/tests/unit/plugins/modules/test_nios_ptr_record.py @@ -133,7 +133,7 @@ def test_nios_ptr_record_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.called_once_with(test_object) + wapi.update_object.assert_called_once_with(test_object) def test_nios_ptr_record_update_record_ptrdname(self): self.module.params = {'provider': None, 'state': 'present', 'ptrdname': 'ansible.test.org', @@ -162,7 +162,7 @@ def test_nios_ptr_record_update_record_ptrdname(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.called_once_with(test_object) + wapi.update_object.assert_called_once_with(test_object) def test_nios_ptr6_record_create(self): self.module.params = {'provider': None, 'state': 'present', 'ptrdname': 'ansible6.test.com', From 31d65e37d1d3bfc709ca9da889b810bdea4a7cf5 Mon Sep 17 00:00:00 2001 From: Jeenitkumar Khatri Date: Fri, 28 Jun 2024 17:03:47 +0530 Subject: [PATCH 09/10] [FIX] compact file deprication for ansible-2.17 --- .github/workflows/ansible-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index da2e4aec..ed40dd7c 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -83,7 +83,7 @@ jobs: run: | ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz git clone https://github.com/ansible/ansible.git -b ${{ matrix.ansible-version }} - if [ "${{ matrix.ansible-version }}" != "devel" ]; then cp -rf ansible/test/units/compat /home/runner/.ansible/collections/ansible_collections/infoblox/nios_modules/tests/unit/; fi + if [ "${{ matrix.ansible-version }}" != "devel" ] && [ "${{ matrix.ansible-version }}" != "stable-2.17" ]; then cp -rf ansible/test/units/compat /home/runner/.ansible/collections/ansible_collections/infoblox/nios_modules/tests/unit/; fi cp -rf ansible/test/units/modules/utils.py /home/runner/.ansible/collections/ansible_collections/infoblox/nios_modules/tests/unit/plugins/modules/ sed -i 's/units/ansible_collections.infoblox.nios_modules.tests.unit/' /home/runner/.ansible/collections/ansible_collections/infoblox/nios_modules/tests/unit/plugins/modules/utils.py if [ -f /home/runner/.ansible/collections/ansible_collections/infoblox/nios_modules/tests/unit/requirements.txt ]; then pip install -r /home/runner/.ansible/collections/ansible_collections/infoblox/nios_modules/tests/unit/requirements.txt; fi From cbdac4598361e8ad968d396bda11ed29175ae427 Mon Sep 17 00:00:00 2001 From: Jeenitkumar Khatri Date: Tue, 2 Jul 2024 16:53:46 +0530 Subject: [PATCH 10/10] [FIX] Updated unit test case by replacing called_once_with to assert_called_once_with for python3.12 --- .github/workflows/ansible-test.yml | 12 +++++------ MANIFEST.in | 0 plugins/lookup/nios_next_ip.py | 8 +++++-- tests/unit/plugins/module_utils/test_api.py | 18 +++++++++------- .../plugins/modules/test_nios_a_record.py | 17 ++++++++------- .../plugins/modules/test_nios_aaaa_record.py | 19 +++++++++++------ .../plugins/modules/test_nios_cname_record.py | 8 +++++-- .../plugins/modules/test_nios_dns_view.py | 7 ++++++- .../modules/test_nios_dtc_monitor_http.py | 4 +++- .../modules/test_nios_dtc_monitor_icmp.py | 4 +++- .../modules/test_nios_dtc_monitor_pdp.py | 4 +++- .../modules/test_nios_dtc_monitor_sip.py | 5 +++-- .../modules/test_nios_dtc_monitor_snmp.py | 5 +++-- .../modules/test_nios_dtc_monitor_tcp.py | 4 +++- .../plugins/modules/test_nios_dtc_topology.py | 5 +++-- .../modules/test_nios_fixed_address.py | 13 +++++++++++- .../plugins/modules/test_nios_host_record.py | 17 +++++++++------ .../unit/plugins/modules/test_nios_member.py | 10 +++++++-- .../plugins/modules/test_nios_mx_record.py | 6 ++++-- .../plugins/modules/test_nios_naptr_record.py | 5 ++++- .../unit/plugins/modules/test_nios_network.py | 8 +++++-- .../plugins/modules/test_nios_network_view.py | 21 ++++++++++++------- .../unit/plugins/modules/test_nios_nsgroup.py | 7 +++++-- .../plugins/modules/test_nios_ptr_record.py | 16 ++++++++------ .../plugins/modules/test_nios_srv_record.py | 6 ++++-- tests/unit/plugins/modules/test_nios_zone.py | 5 +++-- tests/unit/requirements.txt | 3 +-- 27 files changed, 160 insertions(+), 77 deletions(-) create mode 100644 MANIFEST.in diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index ed40dd7c..93867d61 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -18,10 +18,10 @@ jobs: - name: Check out code uses: actions/checkout@v2 - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v1 with: - python-version: '3.10' + python-version: '3.11' - name: Install ansible (${{ matrix.ansible-version }}) run: pip install pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check @@ -93,8 +93,8 @@ jobs: - name: Generate coverage report run: | - if [ "${{ matrix.ansible-version }}" == "stable-2.16" ]; then - pip install coverage==7.3.2; + if [ "${{ matrix.ansible-version }}" == "devel" ]; then + pip install coverage==7.5.3; elif [ "${{ matrix.ansible-version }}" == "stable-2.15" ]; then pip install coverage==6.5.0; fi @@ -189,12 +189,12 @@ jobs: ansible-version: [stable-2.15, stable-2.16, stable-2.17, devel] steps: - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v1 with: # it is just required to run that once as "ansible-test sanity" in the docker image # will run on all python versions it supports. - python-version: '3.10' + python-version: 3.11 - name: Install ansible (${{ matrix.ansible-version }}) version run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..e69de29b diff --git a/plugins/lookup/nios_next_ip.py b/plugins/lookup/nios_next_ip.py index d084ad4f..6d79745a 100644 --- a/plugins/lookup/nios_next_ip.py +++ b/plugins/lookup/nios_next_ip.py @@ -53,8 +53,12 @@ - name: return the next 3 available IP addresses for network 192.168.10.0/24 ansible.builtin.set_fact: - ipaddr: "{{ lookup('infoblox.nios_modules.nios_next_ip', '192.168.10.0/24', num=3, - provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}" + ipaddr: "{{ lookup('infoblox.nios_modules.nios_next_ip', + '192.168.10.0/24', + num=3, + provider={'host': 'nios01', + 'username': 'admin', + 'password': 'password'}) }}" - name: return the next 3 available IP addresses for network 192.168.10.0/24 excluding ip addresses - ['192.168.10.1', '192.168.10.2'] ansible.builtin.set_fact: diff --git a/tests/unit/plugins/module_utils/test_api.py b/tests/unit/plugins/module_utils/test_api.py index 6ebf5bad..73911a8d 100644 --- a/tests/unit/plugins/module_utils/test_api.py +++ b/tests/unit/plugins/module_utils/test_api.py @@ -79,11 +79,11 @@ def test_wapi_no_change(self): def test_wapi_change(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'default', 'comment': 'updated comment', 'extattrs': None} - + ref = "networkview/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "networkview/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "name": "default", "extattrs": {} } @@ -99,16 +99,16 @@ def test_wapi_change(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.assert_called_once_with(test_object) + wapi.update_object.assert_called_once_with(ref, {'comment': 'updated comment', 'name': 'default'}) def test_wapi_change_false(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'default', 'comment': 'updated comment', 'extattrs': None, 'fqdn': 'foo'} - + ref = "networkview/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "networkview/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "name": "default", "extattrs": {} } @@ -125,7 +125,9 @@ def test_wapi_change_false(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.assert_called_once_with(test_object) + wapi.update_object.assert_called_once_with( + ref, {'comment': 'updated comment', 'name': 'default'} + ) def test_wapi_extattrs_change(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'default', @@ -161,9 +163,10 @@ def test_wapi_extattrs_nochange(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'default', 'comment': 'test comment', 'extattrs': {'Site': 'test'}} + ref = "networkview/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [{ "comment": "test comment", - "_ref": "networkview/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "name": "default", "extattrs": {'Site': {'value': 'test'}} }] @@ -178,6 +181,7 @@ def test_wapi_extattrs_nochange(self): res = wapi.run('testobject', test_spec) self.assertFalse(res['changed']) + wapi.update_object.assert_not_called() def test_wapi_create(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'ansible', diff --git a/tests/unit/plugins/modules/test_nios_a_record.py b/tests/unit/plugins/modules/test_nios_a_record.py index e0aaf923..164a93a7 100644 --- a/tests/unit/plugins/modules/test_nios_a_record.py +++ b/tests/unit/plugins/modules/test_nios_a_record.py @@ -53,7 +53,7 @@ def _get_wapi(self, test_object): wapi = api.WapiModule(self.module) wapi.get_object = Mock(name='get_object', return_value=test_object) wapi.create_object = Mock(name='create_object') - wapi.update_object = Mock(name='update_object') + wapi.update_object = Mock(name='update_object', ) wapi.delete_object = Mock(name='delete_object') return wapi @@ -86,10 +86,11 @@ def test_nios_a_record_update_comment(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'a.ansible.com', 'ipv4': '192.168.10.1', 'comment': 'updated comment', 'extattrs': None} + ref = "arecord/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "arecord/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "name": "a.ansible.com", "ipv4": "192.168.10.1", "extattrs": {} @@ -105,8 +106,10 @@ def test_nios_a_record_update_comment(self): wapi = self._get_wapi(test_object) res = wapi.run('testobject', test_spec) - self.assertTrue(res['changed']) + wapi.update_object.assert_called_once_with( + ref, {'comment': 'updated comment', 'ipv4': '192.168.10.1', 'name': 'a.ansible.com'} + ) def test_nios_a_record_remove(self): self.module.params = {'provider': None, 'state': 'absent', 'name': 'a.ansible.com', 'ipv4': '192.168.10.1', @@ -139,12 +142,12 @@ def test_nios_a_record_update_record_name(self): self.module.params = {'provider': None, 'state': 'present', 'name': {'new_name': 'a_new.ansible.com', 'old_name': 'a.ansible.com'}, 'comment': 'comment', 'extattrs': None} + ref = "arecord/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "arecord/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", - "name": "a_new.ansible.com", - "old_name": "a.ansible.com", + "_ref": ref, + "name": "a.ansible.com", "extattrs": {} } ] @@ -159,4 +162,4 @@ def test_nios_a_record_update_record_name(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.assert_called_once_with(test_object) + wapi.update_object.assert_called_once_with(ref, {'name': 'a_new.ansible.com', 'comment': 'comment'}) diff --git a/tests/unit/plugins/modules/test_nios_aaaa_record.py b/tests/unit/plugins/modules/test_nios_aaaa_record.py index c53797a3..10b6e18d 100644 --- a/tests/unit/plugins/modules/test_nios_aaaa_record.py +++ b/tests/unit/plugins/modules/test_nios_aaaa_record.py @@ -86,10 +86,11 @@ def test_nios_aaaa_record_update_comment(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'aaaa.ansible.com', 'ipv6': '2001:0db8:85a3:0000:0000:8a2e:0370:7334', 'comment': 'updated comment', 'extattrs': None} + ref = "aaaarecord/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "aaaarecord/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "name": "aaaa.ansible.com", "ipv6": "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "extattrs": {} @@ -107,6 +108,10 @@ def test_nios_aaaa_record_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) + wapi.update_object.assert_called_once_with( + ref, + {'comment': 'updated comment', 'ipv6': '2001:0db8:85a3:0000:0000:8a2e:0370:7334', 'name': 'aaaa.ansible.com'} + ) def test_nios_aaaa_record_remove(self): self.module.params = {'provider': None, 'state': 'absent', 'name': 'aaaa.ansible.com', @@ -138,13 +143,12 @@ def test_nios_aaaa_record_remove(self): def test_nios_aaaa_record_update_record_name(self): self.module.params = {'provider': None, 'state': 'present', 'name': {'new_name': 'aaaa_new.ansible.com', 'old_name': 'aaaa.ansible.com'}, 'comment': 'comment', 'extattrs': None} - + ref = "aaaarecord/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "aaaarecord/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", - "name": "aaaa_new.ansible.com", - "old_name": "aaaa.ansible.com", + "_ref": ref, + "name": "aaaa.ansible.com", "extattrs": {} } ] @@ -159,4 +163,7 @@ def test_nios_aaaa_record_update_record_name(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.assert_called_once_with(test_object) + wapi.update_object.assert_called_once_with( + ref, + {'comment': 'comment', 'name': 'aaaa_new.ansible.com'} + ) diff --git a/tests/unit/plugins/modules/test_nios_cname_record.py b/tests/unit/plugins/modules/test_nios_cname_record.py index 360a9cc9..3ad17abd 100644 --- a/tests/unit/plugins/modules/test_nios_cname_record.py +++ b/tests/unit/plugins/modules/test_nios_cname_record.py @@ -85,11 +85,11 @@ def test_nios_cname_record_create(self): def test_nios_cname_record_update_comment(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'cname.ansible.com', 'canonical': 'realhost.ansible.com', 'comment': 'updated comment', 'extattrs': None} - + ref = "cnamerecord/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "cnamerecord/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "name": "cname.ansible.com", "canonical": "realhost.ansible.com", "extattrs": {} @@ -107,6 +107,10 @@ def test_nios_cname_record_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) + wapi.update_object.assert_called_once_with( + ref, + {'comment': 'updated comment', 'name': 'cname.ansible.com', 'canonical': 'realhost.ansible.com'} + ) def test_nios_cname_record_remove(self): self.module.params = {'provider': None, 'state': 'absent', 'name': 'cname.ansible.com', diff --git a/tests/unit/plugins/modules/test_nios_dns_view.py b/tests/unit/plugins/modules/test_nios_dns_view.py index b4933b55..ba003c8f 100644 --- a/tests/unit/plugins/modules/test_nios_dns_view.py +++ b/tests/unit/plugins/modules/test_nios_dns_view.py @@ -58,6 +58,9 @@ def _get_wapi(self, test_object): return wapi def load_fixtures(self, commands=None): + """ + Load fixtures for the module + """ self.exec_command.return_value = (0, load_fixture('nios_result.txt').strip(), None) self.load_config.return_value = dict(diff=None, session='session') @@ -84,10 +87,11 @@ def test_nios_dns_view_update_comment(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'ansible-dns', 'comment': 'updated comment', 'extattrs': None} + ref = "dnsview/ZG5zLm5ldHdvcmtfdmlldyQw:ansible/true" test_object = [ { "comment": "test comment", - "_ref": "dnsview/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "name": "ansible-dns", "extattrs": {} } @@ -103,6 +107,7 @@ def test_nios_dns_view_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) + wapi.update_object.assert_called_once_with(ref, {'comment': 'updated comment', 'name': 'ansible-dns'}) def test_nios_dns_view_remove(self): self.module.params = {'provider': None, 'state': 'absent', 'name': 'ansible-dns', diff --git a/tests/unit/plugins/modules/test_nios_dtc_monitor_http.py b/tests/unit/plugins/modules/test_nios_dtc_monitor_http.py index d053f0bf..037ea92b 100644 --- a/tests/unit/plugins/modules/test_nios_dtc_monitor_http.py +++ b/tests/unit/plugins/modules/test_nios_dtc_monitor_http.py @@ -84,10 +84,11 @@ def test_nios_dtc_monitor_http_update_comment(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'https_monitor', 'comment': 'updated comment', 'extattrs': None} + ref = "dtc:monitor:http/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "dtc:monitor:http/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "name": "https_monitor", "port": 443, "secure": True, @@ -105,6 +106,7 @@ def test_nios_dtc_monitor_http_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) + wapi.update_object.assert_called_once_with(ref, {'comment': 'updated comment', 'name': 'https_monitor'}) def test_nios_dtc_monitor_http_remove(self): self.module.params = {'provider': None, 'state': 'absent', 'name': 'https_monitor', diff --git a/tests/unit/plugins/modules/test_nios_dtc_monitor_icmp.py b/tests/unit/plugins/modules/test_nios_dtc_monitor_icmp.py index fb4b300d..78f13365 100644 --- a/tests/unit/plugins/modules/test_nios_dtc_monitor_icmp.py +++ b/tests/unit/plugins/modules/test_nios_dtc_monitor_icmp.py @@ -81,10 +81,11 @@ def test_nios_dtc_monitor_icmp_update_comment(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'icmp_monitor', 'comment': 'updated comment', 'extattrs': None} + ref = "dtc:monitor:icmp/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "dtc:monitor:icmp/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "name": "icmp_monitor", "extattrs": {} } @@ -100,6 +101,7 @@ def test_nios_dtc_monitor_icmp_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) + wapi.update_object.assert_called_once_with(ref, {'comment': 'updated comment', 'name': 'icmp_monitor'}) def test_nios_dtc_monitor_icmp_remove(self): self.module.params = {'provider': None, 'state': 'absent', 'name': 'icmp_monitor', diff --git a/tests/unit/plugins/modules/test_nios_dtc_monitor_pdp.py b/tests/unit/plugins/modules/test_nios_dtc_monitor_pdp.py index 80263784..0fb63682 100644 --- a/tests/unit/plugins/modules/test_nios_dtc_monitor_pdp.py +++ b/tests/unit/plugins/modules/test_nios_dtc_monitor_pdp.py @@ -81,10 +81,11 @@ def test_nios_dtc_monitor_pdp_update_comment(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'pdp_monitor', 'comment': 'updated comment', 'extattrs': None} + ref = "dtc:monitor:pdp/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "dtc:monitor:pdp/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "name": "pdp_monitor", "port": 2123, "extattrs": {} @@ -101,6 +102,7 @@ def test_nios_dtc_monitor_pdp_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) + wapi.update_object.assert_called_once_with(ref, {'comment': 'updated comment', 'name': 'pdp_monitor'}) def test_nios_dtc_monitor_pdp_remove(self): self.module.params = {'provider': None, 'state': 'absent', 'name': 'pdp_monitor', diff --git a/tests/unit/plugins/modules/test_nios_dtc_monitor_sip.py b/tests/unit/plugins/modules/test_nios_dtc_monitor_sip.py index 90b86bfa..6e170d75 100644 --- a/tests/unit/plugins/modules/test_nios_dtc_monitor_sip.py +++ b/tests/unit/plugins/modules/test_nios_dtc_monitor_sip.py @@ -80,11 +80,11 @@ def test_nios_dtc_monitor_sip_create(self): def test_nios_dtc_monitor_sip_update_comment(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'sip_monitor', 'comment': 'updated comment', 'extattrs': None} - + ref = "dtc:monitor:sip/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "dtc:monitor:sip/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "name": "sip_monitor", "extattrs": {} } @@ -100,6 +100,7 @@ def test_nios_dtc_monitor_sip_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) + wapi.update_object.assert_called_once_with(ref, {'comment': 'updated comment', 'name': 'sip_monitor'}) def test_nios_dtc_monitor_sip_remove(self): self.module.params = {'provider': None, 'state': 'absent', 'name': 'sip_monitor', diff --git a/tests/unit/plugins/modules/test_nios_dtc_monitor_snmp.py b/tests/unit/plugins/modules/test_nios_dtc_monitor_snmp.py index 838a35eb..374b5a67 100644 --- a/tests/unit/plugins/modules/test_nios_dtc_monitor_snmp.py +++ b/tests/unit/plugins/modules/test_nios_dtc_monitor_snmp.py @@ -80,11 +80,11 @@ def test_nios_dtc_monitor_snmp_create(self): def test_nios_dtc_monitor_snmp_update_comment(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'snmp_monitor', 'comment': 'updated comment', 'extattrs': None} - + ref = "dtc:monitor:snmp/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "dtc:monitor:snmp/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "name": "snmp_monitor", "port": 161, "version": "V2C", @@ -107,6 +107,7 @@ def test_nios_dtc_monitor_snmp_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) + wapi.update_object.assert_called_once_with(ref, {'comment': 'updated comment', 'name': 'snmp_monitor'}) def test_nios_dtc_monitor_snmp_remove(self): self.module.params = {'provider': None, 'state': 'absent', 'name': 'snmp_monitor', diff --git a/tests/unit/plugins/modules/test_nios_dtc_monitor_tcp.py b/tests/unit/plugins/modules/test_nios_dtc_monitor_tcp.py index 072ba1a3..8de3d25f 100644 --- a/tests/unit/plugins/modules/test_nios_dtc_monitor_tcp.py +++ b/tests/unit/plugins/modules/test_nios_dtc_monitor_tcp.py @@ -83,10 +83,11 @@ def test_nios_dtc_monitor_tcp_update_comment(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'tcp_monitor', 'comment': 'updated comment', 'extattrs': None} + ref = "dtc:monitor:tcp/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "dtc:monitor:tcp/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "name": "tcp_monitor", "port": 8080, "extattrs": {} @@ -103,6 +104,7 @@ def test_nios_dtc_monitor_tcp_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) + wapi.update_object.assert_called_once_with(ref, {'comment': 'updated comment', 'name': 'tcp_monitor'}) def test_nios_dtc_monitor_tcp_remove(self): self.module.params = {'provider': None, 'state': 'absent', 'name': 'tcp_monitor', diff --git a/tests/unit/plugins/modules/test_nios_dtc_topology.py b/tests/unit/plugins/modules/test_nios_dtc_topology.py index d0ee4c69..6a11515b 100644 --- a/tests/unit/plugins/modules/test_nios_dtc_topology.py +++ b/tests/unit/plugins/modules/test_nios_dtc_topology.py @@ -101,10 +101,10 @@ def test_nios_dtc_topology_create(self): def test_nios_dtc_topology_update_comment(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'a_topology', 'comment': 'updated comment', 'extattrs': None} - + ref = "dtc:topology/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { - '_ref': 'dtc:topology/ZG5zLm5ldHdvcmtfdmlldyQw:default/true', + '_ref': ref, 'name': 'a_topology', 'rules': [{ '_ref': 'dtc:topology:rule/ZG5zLm5ldHdvcmtfdmlldyQw:a_topology/web_pool' @@ -124,6 +124,7 @@ def test_nios_dtc_topology_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) + wapi.update_object.assert_called_once_with(ref, {'comment': 'updated comment', 'name': 'a_topology'}) def test_nios_dtc_topology_remove(self): self.module.params = {'provider': None, 'state': 'absent', 'name': 'a_topology', diff --git a/tests/unit/plugins/modules/test_nios_fixed_address.py b/tests/unit/plugins/modules/test_nios_fixed_address.py index ae373fd3..ba435b76 100644 --- a/tests/unit/plugins/modules/test_nios_fixed_address.py +++ b/tests/unit/plugins/modules/test_nios_fixed_address.py @@ -82,11 +82,12 @@ def test_nios_fixed_address_ipv4_dhcp_update(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'test_fa', 'ipaddr': '192.168.10.1', 'mac': '08:6d:41:e8:fd:e8', 'network': '192.168.10.0/24', 'network_view': 'default', 'comment': 'updated comment', 'extattrs': None} + ref = "network/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", "name": "test_fa", - "_ref": "network/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "ipaddr": "192.168.10.1", "mac": "08:6d:41:e8:fd:e8", "network": "192.168.10.0/24", @@ -109,6 +110,16 @@ def test_nios_fixed_address_ipv4_dhcp_update(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) + wapi.update_object.assert_called_once_with( + ref, + { + 'comment': 'updated comment', + 'name': 'test_fa', + 'ipaddr': '192.168.10.1', + 'mac': '08:6d:41:e8:fd:e8', + 'network': '192.168.10.0/24', + } + ) def test_nios_fixed_address_ipv4_remove(self): self.module.params = {'provider': None, 'state': 'absent', 'name': 'test_fa', 'ipaddr': '192.168.10.1', 'mac': '08:6d:41:e8:fd:e8', diff --git a/tests/unit/plugins/modules/test_nios_host_record.py b/tests/unit/plugins/modules/test_nios_host_record.py index 6dc292ec..7bc72337 100644 --- a/tests/unit/plugins/modules/test_nios_host_record.py +++ b/tests/unit/plugins/modules/test_nios_host_record.py @@ -107,10 +107,11 @@ def test_nios_host_record_update_comment(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'default', 'comment': 'updated comment', 'extattrs': None} + ref = "record:host/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "record:host/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "name": "default", "extattrs": {} } @@ -126,18 +127,20 @@ def test_nios_host_record_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.assert_called_once_with(test_object) + wapi.update_object.assert_called_once_with( + ref, {'comment': 'updated comment', 'name': 'default'} + ) def test_nios_host_record_update_record_name(self): self.module.params = {'provider': None, 'state': 'present', 'name': {'new_name': 'default', 'old_name': 'old_default'}, 'comment': 'comment', 'extattrs': None} + ref = "record:host/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "record:host/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", - "name": "default", - "old_name": "old_default", + "_ref": ref, + "name": "old_default", "extattrs": {} } ] @@ -152,4 +155,6 @@ def test_nios_host_record_update_record_name(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.assert_called_once_with(test_object) + wapi.update_object.assert_called_once_with( + ref, {'comment': 'comment', 'name': 'default'} + ) diff --git a/tests/unit/plugins/modules/test_nios_member.py b/tests/unit/plugins/modules/test_nios_member.py index a65b5df1..c8e02ce0 100644 --- a/tests/unit/plugins/modules/test_nios_member.py +++ b/tests/unit/plugins/modules/test_nios_member.py @@ -84,11 +84,11 @@ def test_nios_member_update(self): self.module.params = {'provider': None, 'state': 'present', 'host_name': 'test_member', 'vip_setting': {'address': '192.168.1.110', 'subnet_mask': '255.255.255.0', 'gateway': '192.168.1.1'}, 'config_addr_type': 'IPV4', 'platform': 'VNIOS', 'comment': 'updated comment', 'extattrs': None} - + ref = "member/b25lLnZpcnR1YWxfbm9kZSQ3:member01.ansible-dev.com" test_object = [ { "comment": "Created with Ansible", - "_ref": "member/b25lLnZpcnR1YWxfbm9kZSQ3:member01.ansible-dev.com", + "_ref": ref, "config_addr_type": "IPV4", "host_name": "member01.ansible-dev.com", "platform": "VNIOS", @@ -118,6 +118,12 @@ def test_nios_member_update(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) + wapi.update_object.assert_called_once_with( + ref, + {'comment': 'updated comment', 'host_name': 'test_member', + 'vip_setting': {'address': '192.168.1.110', 'subnet_mask': '255.255.255.0', 'gateway': '192.168.1.1'}, + 'config_addr_type': 'IPV4', 'platform': 'VNIOS'} + ) def test_nios_member_remove(self): self.module.params = {'provider': None, 'state': 'absent', 'host_name': 'test_member', diff --git a/tests/unit/plugins/modules/test_nios_mx_record.py b/tests/unit/plugins/modules/test_nios_mx_record.py index 55524b4d..7f8db39e 100644 --- a/tests/unit/plugins/modules/test_nios_mx_record.py +++ b/tests/unit/plugins/modules/test_nios_mx_record.py @@ -86,11 +86,11 @@ def test_nios_mx_record_create(self): def test_nios_mx_record_update_comment(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'ansible.com', 'mx': 'mailhost.ansible.com', 'preference': 0, 'comment': 'updated comment', 'extattrs': None} - + ref = "mxrecord/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "mxrecord/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "name": "ansible.com", "mx": "mailhost.ansible.com", "preference": 0, @@ -110,6 +110,8 @@ def test_nios_mx_record_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) + wapi.update_object.assert_called_once_with(ref, {'comment': 'updated comment', 'name': 'ansible.com', + 'mx': 'mailhost.ansible.com', 'preference': 0}) def test_nios_mx_record_remove(self): self.module.params = {'provider': None, 'state': 'absent', 'name': 'ansible.com', 'mx': 'mailhost.ansible.com', diff --git a/tests/unit/plugins/modules/test_nios_naptr_record.py b/tests/unit/plugins/modules/test_nios_naptr_record.py index 44c9c349..38c3f059 100644 --- a/tests/unit/plugins/modules/test_nios_naptr_record.py +++ b/tests/unit/plugins/modules/test_nios_naptr_record.py @@ -91,10 +91,11 @@ def test_nios_naptr_record_update_comment(self): 'order': '1000', 'preference': '10', 'replacement': 'replacement1.network.ansiblezone.com', 'comment': 'updated comment', 'extattrs': None} + ref = "naptrrecord/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "naptrrecord/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "name": "*.subscriber-100.ansiblezone.com", "order": "1000", "preference": "10", @@ -116,6 +117,8 @@ def test_nios_naptr_record_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) + wapi.update_object.assert_called_once_with(ref, {'comment': 'updated comment', 'name': '*.subscriber-100.ansiblezone.com', + 'order': '1000', 'preference': '10', 'replacement': 'replacement1.network.ansiblezone.com'}) def test_nios_naptr_record_remove(self): self.module.params = {'provider': None, 'state': 'absent', 'name': '*.subscriber-100.ansiblezone.com', diff --git a/tests/unit/plugins/modules/test_nios_network.py b/tests/unit/plugins/modules/test_nios_network.py index 0fad5aaa..afc96330 100644 --- a/tests/unit/plugins/modules/test_nios_network.py +++ b/tests/unit/plugins/modules/test_nios_network.py @@ -78,10 +78,11 @@ def test_nios_network_ipv4_dhcp_update(self): self.module.params = {'provider': None, 'state': 'present', 'network': '192.168.10.0/24', 'comment': 'updated comment', 'extattrs': None} + ref = "network/ZG5zLm5ldHdvcmtfdmlldyQw:ansible/true" test_object = [ { "comment": "test comment", - "_ref": "network/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "network": "192.168.10.0/24", "extattrs": {'options': {'name': 'test', 'value': 'ansible.com'}} } @@ -97,15 +98,17 @@ def test_nios_network_ipv4_dhcp_update(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) + wapi.update_object.assert_called_once_with(ref, {'comment': 'updated comment', 'network': '192.168.10.0/24'}) def test_nios_network_ipv6_dhcp_update(self): self.module.params = {'provider': None, 'state': 'present', 'ipv6network': 'fe80::/64', 'comment': 'updated comment', 'extattrs': None} + ref = "ipv6network/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "ipv6network/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "ipv6network": "fe80::/64", "extattrs": {'options': {'name': 'test', 'value': 'ansible.com'}} } @@ -120,6 +123,7 @@ def test_nios_network_ipv6_dhcp_update(self): wapi = self._get_wapi(test_object) res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) + wapi.update_object.assert_called_once_with(ref, {'comment': 'updated comment', 'ipv6network': 'fe80::/64'}) def test_nios_network_ipv4_remove(self): self.module.params = {'provider': None, 'state': 'absent', 'network': '192.168.10.0/24', diff --git a/tests/unit/plugins/modules/test_nios_network_view.py b/tests/unit/plugins/modules/test_nios_network_view.py index b768297e..24ee5fbd 100644 --- a/tests/unit/plugins/modules/test_nios_network_view.py +++ b/tests/unit/plugins/modules/test_nios_network_view.py @@ -83,11 +83,11 @@ def test_nios_network_view_create(self): def test_nios_network_view_update_comment(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'default', 'comment': 'updated comment', 'extattrs': None, 'network_view': 'default'} - + ref = "networkview/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "networkview/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "name": "default", "extattrs": {}, "network_view": "default" @@ -104,18 +104,20 @@ def test_nios_network_view_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.assert_called_once_with(test_object) + wapi.update_object.assert_called_once_with( + ref, + {'comment': 'updated comment', 'name': 'default'} + ) def test_nios_network_view_update_name(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'default', 'old_name': 'old_default', 'comment': 'updated comment', 'extattrs': None, 'network_view': 'default'} - + ref = "networkview/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "networkview/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", - "name": "default", - "old_name": "old_default", + "_ref": ref, + "name": "old_default", "extattrs": {}, "network_view": "default" } @@ -131,7 +133,10 @@ def test_nios_network_view_update_name(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.assert_called_once_with(test_object) + wapi.update_object.assert_called_once_with( + ref, + {'comment': 'updated comment', 'name': 'default'} + ) def test_nios_network_view_remove(self): self.module.params = {'provider': None, 'state': 'absent', 'name': 'ansible', diff --git a/tests/unit/plugins/modules/test_nios_nsgroup.py b/tests/unit/plugins/modules/test_nios_nsgroup.py index a99c6ec1..195ea7a7 100644 --- a/tests/unit/plugins/modules/test_nios_nsgroup.py +++ b/tests/unit/plugins/modules/test_nios_nsgroup.py @@ -107,10 +107,11 @@ def test_nios_nsgroup_update_comment(self): self.module.params = {'provider': None, 'state': 'present', 'name': 'default', 'comment': 'updated comment', 'grid_primary': None} + ref = "nsgroup/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "nsgroup/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "name": "default", "grid_primary": {} } @@ -126,4 +127,6 @@ def test_nios_nsgroup_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.assert_called_once_with(test_object) + wapi.update_object.assert_called_once_with( + ref, {'comment': 'updated comment', 'name': 'default'} + ) diff --git a/tests/unit/plugins/modules/test_nios_ptr_record.py b/tests/unit/plugins/modules/test_nios_ptr_record.py index 67a9d5d8..68f69b9c 100644 --- a/tests/unit/plugins/modules/test_nios_ptr_record.py +++ b/tests/unit/plugins/modules/test_nios_ptr_record.py @@ -109,11 +109,11 @@ def test_nios_ptr_record_remove(self): def test_nios_ptr_record_update_comment(self): self.module.params = {'provider': None, 'state': 'present', 'ptrdname': 'ansible.test.com', 'ipv4addr': '10.36.241.14', 'comment': 'updated comment', 'extattrs': None, 'view': 'default'} - + ref = "record:ptr/ZG5zLm5ldHdvcmtfdmlldyQw:14.241.36.10.in-addr.arpa/default" test_object = [ { "comment": "test comment", - "_ref": "record:ptr/ZG5zLm5ldHdvcmtfdmlldyQw:14.241.36.10.in-addr.arpa/default", + "_ref": ref, "ptrdname": "ansible.test.com", "ipv4addr": "10.36.241.14", "extattrs": {}, @@ -133,16 +133,18 @@ def test_nios_ptr_record_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.assert_called_once_with(test_object) + wapi.update_object.assert_called_once_with( + ref, {'comment': 'updated comment', 'ptrdname': 'ansible.test.com', 'ipv4addr': '10.36.241.14', 'view': 'default'} + ) def test_nios_ptr_record_update_record_ptrdname(self): self.module.params = {'provider': None, 'state': 'present', 'ptrdname': 'ansible.test.org', 'ipv4addr': '10.36.241.14', 'comment': 'comment', 'extattrs': None, 'view': 'default'} - + ref = "record:ptr/ZG5zLm5ldHdvcmtfdmlldyQw:14.241.36.10.in-addr.arpa/default" test_object = [ { "comment": "test comment", - "_ref": "record:ptr/ZG5zLm5ldHdvcmtfdmlldyQw:14.241.36.10.in-addr.arpa/default", + "_ref": ref, "ptrdname": "ansible.test.com", "ipv4addr": "10.36.241.14", "extattrs": {}, @@ -162,7 +164,9 @@ def test_nios_ptr_record_update_record_ptrdname(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) - wapi.update_object.assert_called_once_with(test_object) + wapi.update_object.assert_called_once_with( + ref, {'comment': 'comment', 'ptrdname': 'ansible.test.org', 'ipv4addr': '10.36.241.14', 'view': 'default'} + ) def test_nios_ptr6_record_create(self): self.module.params = {'provider': None, 'state': 'present', 'ptrdname': 'ansible6.test.com', diff --git a/tests/unit/plugins/modules/test_nios_srv_record.py b/tests/unit/plugins/modules/test_nios_srv_record.py index 9a6f3fb3..5c41cd4c 100644 --- a/tests/unit/plugins/modules/test_nios_srv_record.py +++ b/tests/unit/plugins/modules/test_nios_srv_record.py @@ -90,11 +90,11 @@ def test_nios_srv_record_update_comment(self): self.module.params = {'provider': None, 'state': 'present', 'name': '_sip._tcp.service.ansible.com', 'port': 5080, 'target': 'service1.ansible.com', 'priority': 10, 'weight': 10, 'comment': None, 'extattrs': None} - + ref = "srvrecord/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "srvrecord/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "name": "_sip._tcp.service.ansible.com", 'port': 5080, "target": "mailhost.ansible.com", @@ -118,6 +118,8 @@ def test_nios_srv_record_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) + wapi.update_object.assert_called_once_with(ref, {'name': '_sip._tcp.service.ansible.com', + 'port': 5080, 'target': 'service1.ansible.com', 'priority': 10, 'weight': 10}) def test_nios_srv_record_remove(self): self.module.params = {'provider': None, 'state': 'absent', 'name': '_sip._tcp.service.ansible.com', diff --git a/tests/unit/plugins/modules/test_nios_zone.py b/tests/unit/plugins/modules/test_nios_zone.py index 693ab060..20230c8e 100644 --- a/tests/unit/plugins/modules/test_nios_zone.py +++ b/tests/unit/plugins/modules/test_nios_zone.py @@ -104,11 +104,11 @@ def test_nios_zone_remove(self): def test_nios_zone_update_comment(self): self.module.params = {'provider': None, 'state': 'present', 'fqdn': 'ansible.com', 'comment': 'updated comment', 'extattrs': None} - + ref = "zone/ZG5zLm5ldHdvcmtfdmlldyQw:default/true" test_object = [ { "comment": "test comment", - "_ref": "zone/ZG5zLm5ldHdvcmtfdmlldyQw:default/true", + "_ref": ref, "fqdn": "ansible.com", "extattrs": {'Site': {'value': 'test'}} } @@ -124,6 +124,7 @@ def test_nios_zone_update_comment(self): res = wapi.run('testobject', test_spec) self.assertTrue(res['changed']) + wapi.update_object.assert_called_once_with(ref, {'comment': 'updated comment', 'fqdn': 'ansible.com'}) def test_nios_zone_create_using_grid_primary_secondaries(self): self.module.params = {'provider': None, 'state': 'present', 'fqdn': 'ansible.com', diff --git a/tests/unit/requirements.txt b/tests/unit/requirements.txt index e2aefbb4..c64045e9 100644 --- a/tests/unit/requirements.txt +++ b/tests/unit/requirements.txt @@ -5,5 +5,4 @@ pytest-xdist mock pytest-mock pytest-cov -coverage - +coverage==7.3.2