def test_list_match_different_minion_id(self): """ Tests for situations where the list matcher is called with a different minion_id than what is found in __opts__ """ # not passing minion_id, should return False self.assertFalse(match.list_("bar02,bar04")) # passing minion_id, should return True self.assertTrue(match.list_("bar02,bar04", "bar04"))
def test_list_(self, mock_matcher): ''' Test for Return True if the minion ID matches the given list target ''' with patch.dict(match.__grains__, {'id': 101}): mock_matcher.side_effect = MagicMock() with patch.object(mock_matcher, 'list_match', MagicMock()): self.assertTrue(match.list_('tgt')) mock_matcher.side_effect = MagicMock(return_value='B') self.assertFalse(match.list_('tgt'))