Beispiel #1
0
 def test_auth_traps_enabled(self):
     '''
     Test - Manage the sending of authentication traps.
     '''
     kwargs = {'name': 'auth-traps', 'status': True}
     ret = {
         'name': kwargs['name'],
         'changes': {
             'old': False,
             'new': True
         },
         'comment':
         'Set EnableAuthenticationTraps to contain the provided value.',
         'result': True
     }
     mock_value_get = MagicMock(return_value=False)
     mock_value_set = MagicMock(return_value=True)
     with patch.dict(
             win_snmp.__salt__, {
                 'win_snmp.get_auth_traps_enabled': mock_value_get,
                 'win_snmp.set_auth_traps_enabled': mock_value_set
             }):
         with patch.dict(win_snmp.__opts__, {'test': False}):
             self.assertEqual(win_snmp.auth_traps_enabled(**kwargs), ret)
         with patch.dict(win_snmp.__opts__, {'test': True}):
             ret['comment'] = 'EnableAuthenticationTraps will be changed.'
             ret['result'] = None
             self.assertEqual(win_snmp.auth_traps_enabled(**kwargs), ret)
Beispiel #2
0
def test_auth_traps_enabled():
    """
    Test - Manage the sending of authentication traps.
    """
    kwargs = {"name": "auth-traps", "status": True}
    ret = {
        "name": kwargs["name"],
        "changes": {
            "old": False,
            "new": True
        },
        "comment":
        "Set EnableAuthenticationTraps to contain the provided value.",
        "result": True,
    }
    mock_value_get = MagicMock(return_value=False)
    mock_value_set = MagicMock(return_value=True)
    with patch.dict(
            win_snmp.__salt__,
        {
            "win_snmp.get_auth_traps_enabled": mock_value_get,
            "win_snmp.set_auth_traps_enabled": mock_value_set,
        },
    ):
        with patch.dict(win_snmp.__opts__, {"test": False}):
            assert win_snmp.auth_traps_enabled(**kwargs) == ret
        with patch.dict(win_snmp.__opts__, {"test": True}):
            ret["comment"] = "EnableAuthenticationTraps will be changed."
            ret["result"] = None
            assert win_snmp.auth_traps_enabled(**kwargs) == ret