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