Add unit test for _get_pillar_errors when both external and internal pillars contains errors

This commit is contained in:
Bo Maryniuk 2017-11-21 13:53:34 +01:00
parent 218a59e93b
commit 68480d5dc9

View file

@ -1005,3 +1005,17 @@ class StateTestCase(TestCase, LoaderModuleMockMixin):
({'force': False}, errors),
({}, errors)]:
assert res == state._get_pillar_errors(kwargs=opts, pillar=ext_pillar)
def test_get_pillar_errors_EE(self):
'''
Test _get_pillar_errors function.
CC: External erroneous, Internal erroneous
:return:
'''
errors = ['failure', 'everywhere']
for int_pillar, ext_pillar in [({'foo': 'bar', '_errors': errors}, {'fred': 'baz', '_errors': errors})]:
with patch('salt.modules.state.__pillar__', int_pillar):
for opts, res in [({'force': True}, None),
({'force': False}, errors),
({}, errors)]:
assert res == state._get_pillar_errors(kwargs=opts, pillar=ext_pillar)