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_create_generic_protocol(self, *args):
        set_module_args(
            dict(name='foo',
                 partition='foobar',
                 description='my description',
                 parent='barfoo',
                 disable_parser=True,
                 max_egress_buffer=10000,
                 max_msg_size=2000,
                 msg_terminator='%%%%',
                 no_response=False,
                 provider=dict(server='localhost',
                               password='******',
                               user='******')))

        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=False)
        mm.create_on_device = Mock(return_value=True)
        mm.version_less_than_14 = Mock(return_value=False)

        results = mm.exec_module()

        assert results['changed'] is True
        assert results['description'] == 'my description'
        assert results['parent'] == '/foobar/barfoo'
        assert results['disable_parser'] == 'yes'
        assert results['max_egress_buffer'] == 10000
        assert results['max_msg_size'] == 2000
        assert results['msg_terminator'] == '%%%%'
        assert results['no_response'] == 'no'