def test_update_generic_protocol(self, *args): set_module_args( dict(name='foobar', disable_parser=True, max_egress_buffer=10000, max_msg_size=2000, provider=dict(server='localhost', password='******', user='******'))) current = ApiParameters( params=load_fixture('load_generic_parser.json')) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode) # Override methods in the specific type of manager mm = ModuleManager(module=module) mm.exists = Mock(return_value=True) mm.update_on_device = Mock(return_value=True) mm.read_current_from_device = Mock(return_value=current) mm.version_less_than_14 = Mock(return_value=False) results = mm.exec_module() assert results['changed'] is True assert results['disable_parser'] == 'yes' assert results['max_egress_buffer'] == 10000 assert results['max_msg_size'] == 2000
def test_api_parameters(self): args = load_fixture('load_generic_parser.json') p = ApiParameters(params=args) assert p.name == 'foobar' assert p.partition == 'Common' assert p.parent == '/Common/genericmsg' assert p.disable_parser == 'no' assert p.max_egress_buffer == 32768 assert p.max_msg_size == 32768 assert p.no_response == 'no'