예제 #1
0
 def test_community_names(self):
     '''
     Test - Manage the SNMP accepted community names and their permissions.
     '''
     kwargs = {
         'name': 'community-names',
         'communities': {
             'TestCommunity': 'Read Create'
         }
     }
     ret = {
         'name': kwargs['name'],
         'changes': {},
         'comment': 'Communities already contain the provided values.',
         'result': True
     }
     mock_value_get = MagicMock(return_value=kwargs['communities'])
     mock_value_set = MagicMock(return_value=True)
     with patch.dict(
             win_snmp.__salt__, {
                 'win_snmp.get_community_names': mock_value_get,
                 'win_snmp.set_community_names': mock_value_set
             }):
         with patch.dict(win_snmp.__opts__, {'test': False}):
             self.assertEqual(win_snmp.community_names(**kwargs), ret)
예제 #2
0
def test_community_names():
    """
    Test - Manage the SNMP accepted community names and their permissions.
    """
    kwargs = {
        "name": "community-names",
        "communities": {
            "TestCommunity": "Read Create"
        },
    }
    ret = {
        "name": kwargs["name"],
        "changes": {},
        "comment": "Communities already contain the provided values.",
        "result": True,
    }
    mock_value_get = MagicMock(return_value=kwargs["communities"])
    mock_value_set = MagicMock(return_value=True)
    with patch.dict(
            win_snmp.__salt__,
        {
            "win_snmp.get_community_names": mock_value_get,
            "win_snmp.set_community_names": mock_value_set,
        },
    ):
        with patch.dict(win_snmp.__opts__, {"test": False}):
            assert win_snmp.community_names(**kwargs) == ret