def test_module_args(mock_module, mock_check_setting, mock_modify_config):
    """ cl_quagga_protocol - Test module argument specs"""
    instance = mock_module.return_value
    instance.params.get.side_effect = mod_args_generator(mod_args)
    main()
    mock_module.assert_called_with(
        argument_spec={
            'name': {
                'type': 'str',
                'choices': ['ospfd', 'ospf6d', 'bgpd'],
                'required': True
            },
            'activate': {
                'type':
                'bool',
                'choices':
                ['yes', 'on', '1', 'true', 1, 'no', 'off', '0', 'false', 0],
                'default':
                False
            },
            'state': {
                'type': 'str',
                'choices': ['present', 'absent'],
                'required': True
            }
        })
    assert_equals(instance.quagga_daemon_file, '/etc/quagga/daemons')
def test_restarting_quagga(mock_module, mock_check_setting, mock_modify_config,
                           mock_run_cmd):
    """
    cl_quagga_protocol - test restarting quagga
    """
    instance = mock_module.return_value
    # activate = yes
    values = mod_args.copy()
    values['activate'] = True
    instance.params.get.side_effect = mod_args_generator(values)
    main()
    _msg = 'ospfd protocol setting modified to yes. Restarted Quagga Service'
    instance.exit_json.assert_called_with(msg=_msg, changed=True)
    # activate = no
    values = mod_args.copy()
    values['activate'] = False
    instance.params.get.side_effect = mod_args_generator(values)
    main()
    _msg = 'ospfd protocol setting modified to yes'
    instance.exit_json.assert_called_with(msg=_msg, changed=True)
def test_restarting_quagga(mock_module,
                           mock_check_setting,
                           mock_modify_config,
                           mock_run_cmd):
    """
    cl_quagga_protocol - test restarting quagga
    """
    instance = mock_module.return_value
    # activate = yes
    values = mod_args.copy()
    values['activate'] = True
    instance.params.get.side_effect = mod_args_generator(values)
    main()
    _msg = 'ospfd protocol setting modified to yes. Restarted Quagga Service'
    instance.exit_json.assert_called_with(msg=_msg, changed=True)
    # activate = no
    values = mod_args.copy()
    values['activate'] = False
    instance.params.get.side_effect = mod_args_generator(values)
    main()
    _msg = 'ospfd protocol setting modified to yes'
    instance.exit_json.assert_called_with(msg=_msg, changed=True)
def test_module_args(mock_module,
                     mock_check_setting,
                     mock_modify_config):
    """ cl_quagga_protocol - Test module argument specs"""
    instance = mock_module.return_value
    instance.params.get.side_effect = mod_args_generator(mod_args)
    main()
    mock_module.assert_called_with(
        argument_spec={'name':
                       {'type': 'str', 'choices':
                        ['ospfd', 'ospf6d', 'bgpd'],
                        'required': True},
                       'activate': {
                           'type': 'bool',
                           'choices': ['yes', 'on', '1', 'true', 1,
                                       'no', 'off', '0', 'false', 0],
                           'default': False
                       },
                       'state': {'type': 'str',
                                 'choices': ['present', 'absent'],
                                 'required': True}
                       })
    assert_equals(instance.quagga_daemon_file,
                  '/etc/quagga/daemons')