def test_update_ntp_servers(self, *args): ntp = ['10.1.1.1', '10.1.1.2'] set_module_args( dict(ntp_servers=ntp, provider=dict(server='localhost', password='******', user='******'))) # Configure the parameters that would be returned by querying the # remote device current = Parameters(params=load_fixture('load_ntp.json')) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode, required_one_of=self.spec.required_one_of) mm = ModuleManager(module=module) # Override methods to force specific logic in the module to happen mm.update_on_device = Mock(return_value=True) mm.read_current_from_device = Mock(return_value=current) results = mm.exec_module() assert results['changed'] is True assert results['ntp_servers'] == ntp
def test_api_parameters(self): ntp = ['192.168.1.1', '192.168.1.2'] args = dict(servers=ntp, timezone='Arctic/Longyearbyen') p = Parameters(params=args) assert p.ntp_servers == ntp assert p.timezone == 'Arctic/Longyearbyen'