mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add integration test for checking the type of the __sls__ field
We should add a bunch more of these for other fields. Or we should just use Typings to define the return from the state functions. ^_^
This commit is contained in:
parent
e4cf3931b3
commit
15826ca207
2 changed files with 21 additions and 0 deletions
3
tests/integration/files/file/base/gndn.sls
Normal file
3
tests/integration/files/file/base/gndn.sls
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Goes nowhere, does nothing.
|
||||
gndn:
|
||||
test.succeed_with_changes
|
|
@ -99,6 +99,24 @@ class StateModuleTest(integration.ModuleCase,
|
|||
for field in running_dict_fields:
|
||||
self.assertIn(field, ret)
|
||||
|
||||
def test_running_dictionary_key_sls(self):
|
||||
'''
|
||||
Ensure the __sls__ key is either null or a string
|
||||
'''
|
||||
sls1 = self.run_function('state.single',
|
||||
fun='test.succeed_with_changes',
|
||||
name='gndn')
|
||||
|
||||
sls2 = self.run_function('state.sls', mods='gndn')
|
||||
|
||||
for state, ret in sls1.items():
|
||||
key_type = type(ret['__sls__'])
|
||||
self.assertTrue(key_type is str or key_type is type(None))
|
||||
|
||||
for state, ret in sls2.items():
|
||||
key_type = type(ret['__sls__'])
|
||||
self.assertTrue(key_type is str or key_type is type(None))
|
||||
|
||||
def _remove_request_cache_file(self):
|
||||
'''
|
||||
remove minion state request file
|
||||
|
|
Loading…
Add table
Reference in a new issue