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:
Seth House 2016-12-05 14:07:03 -07:00
parent e4cf3931b3
commit 15826ca207
2 changed files with 21 additions and 0 deletions

View file

@ -0,0 +1,3 @@
# Goes nowhere, does nothing.
gndn:
test.succeed_with_changes

View file

@ -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