def test_set_community_names(self): ''' Test - Manage the SNMP accepted community names and their permissions. ''' mock_value = MagicMock(return_value=True) kwargs = {'communities': COMMUNITY_NAMES} with patch.dict(win_snmp.__salt__, {'reg.set_value': mock_value}): self.assertTrue(win_snmp.set_community_names(**kwargs))
def test_set_community_names(self): ''' Test - Manage the SNMP accepted community names and their permissions. ''' mock_true = MagicMock(return_value=True) kwargs = {'communities': COMMUNITY_NAMES} mock_false = MagicMock(return_value=False) with patch.dict(win_snmp.__utils__, {'reg.set_value': mock_true, 'reg.key_exists': mock_false}), \ patch('salt.modules.win_snmp.get_community_names', MagicMock(return_value=COMMUNITY_NAMES)): self.assertTrue(win_snmp.set_community_names(**kwargs))
def test_set_community_names(self): """ Test - Manage the SNMP accepted community names and their permissions. """ mock_true = MagicMock(return_value=True) kwargs = {"communities": COMMUNITY_NAMES} mock_false = MagicMock(return_value=False) with patch.dict( win_snmp.__salt__, { "reg.set_value": mock_true, "reg.key_exists": mock_false }, ), patch( "salt.modules.win_snmp.get_community_names", MagicMock(return_value=COMMUNITY_NAMES), ): self.assertTrue(win_snmp.set_community_names(**kwargs))