mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add watch_in integration test
This commit is contained in:
parent
1643bb7fd4
commit
5f2b4f434e
3 changed files with 40 additions and 0 deletions
|
@ -0,0 +1,7 @@
|
|||
return_changes:
|
||||
test.succeed_with_changes:
|
||||
- watch_in:
|
||||
- test: watch_states
|
||||
|
||||
watch_states:
|
||||
test.succeed_without_changes
|
|
@ -0,0 +1,7 @@
|
|||
return_changes:
|
||||
test.fail_with_changes:
|
||||
- watch_in:
|
||||
- test: watch_states
|
||||
|
||||
watch_states:
|
||||
test.succeed_without_changes
|
|
@ -586,6 +586,32 @@ class StateModuleTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
#result = self.normalize_ret(ret)
|
||||
#self.assertEqual(expected_result, result)
|
||||
|
||||
def test_watch_in(self):
|
||||
'''
|
||||
test watch_in requisite when there is a success
|
||||
'''
|
||||
ret = self.run_function('state.sls', mods='requisites.watch_in')
|
||||
out = iter(ret)
|
||||
f_state = next(out)
|
||||
s_state = next(out)
|
||||
|
||||
self.assertEqual('Watch statement fired.', ret[f_state]['comment'])
|
||||
self.assertEqual('Something pretended to change',
|
||||
ret[s_state]['changes']['testing']['new'])
|
||||
|
||||
def test_watch_in_failure(self):
|
||||
'''
|
||||
test watch_in requisite when there is a failure
|
||||
'''
|
||||
ret = self.run_function('state.sls', mods='requisites.watch_in_failure')
|
||||
out = iter(ret)
|
||||
f_state = next(out)
|
||||
s_state = next(out)
|
||||
|
||||
self.assertEqual(False, ret[f_state]['result'])
|
||||
self.assertEqual('One or more requisite failed: requisites.watch_in_failure.return_changes',
|
||||
ret[s_state]['comment'])
|
||||
|
||||
def normalize_ret(self, ret):
|
||||
'''
|
||||
Normalize the return to the format that we'll use for result checking
|
||||
|
|
Loading…
Add table
Reference in a new issue