Add regex grain match tests

This commit is contained in:
Thomas S Hatch 2012-05-23 09:39:10 -06:00
parent 6eb742727d
commit b25e82c59f

View File

@ -63,6 +63,18 @@ class MatchTest(integration.ShellCase):
self.assertIn('sub_minion', data)
self.assertNotIn('minion', data.replace('sub_minion', 'stub'))
def test_regrain(self):
'''
test salt grain matcher
'''
data = self.run_salt('-t 1 --grain-pcre "test_grain:^cheese$" test.ping')
data = '\n'.join(data)
self.assertIn('minion', data)
self.assertNotIn('sub_minion', data)
data = self.run_salt('--grain-pcre "test_grain:.*am$" test.ping')
data = '\n'.join(data)
self.assertIn('sub_minion', data)
self.assertNotIn('minion', data.replace('sub_minion', 'stub'))
if __name__ == "__main__":
loader = TestLoader()