"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/unit/utils/test_state.py" between
salt-2019.2.0.tar.gz and salt-2019.2.1.tar.gz

About: SaltStack is a systems management software for data center automation, cloud orchestration, server provisioning, configuration management and more. Community version.

test_state.py  (salt-2019.2.0):test_state.py  (salt-2019.2.1)
skipping to change at line 528 skipping to change at line 528
m['changes'] = copy.deepcopy(primary_changes) m['changes'] = copy.deepcopy(primary_changes)
s = copy.deepcopy(self.sub_ret) s = copy.deepcopy(self.sub_ret)
s['changes'] = copy.deepcopy(secondary_changes) s['changes'] = copy.deepcopy(secondary_changes)
res = salt.utils.state.merge_subreturn(m, s, subkey='alarms') res = salt.utils.state.merge_subreturn(m, s, subkey='alarms')
self.assertDictEqual(res['changes'], { self.assertDictEqual(res['changes'], {
'old': None, 'old': None,
'new': 'my_resource', 'new': 'my_resource',
'alarms': secondary_changes, 'alarms': secondary_changes,
}) })
def test_merge_pchanges(self):
primary_pchanges = {'old': None, 'new': 'my_resource'}
secondary_pchanges = {'old': None, 'new': ['alarm-1', 'alarm-2']}
# Neither main nor sub pchanges case
m = copy.deepcopy(self.main_ret)
s = copy.deepcopy(self.sub_ret)
res = salt.utils.state.merge_subreturn(m, s)
self.assertNotIn('pchanges', res)
# No main pchanges, sub pchanges
m = copy.deepcopy(self.main_ret)
s = copy.deepcopy(self.sub_ret)
s['pchanges'] = copy.deepcopy(secondary_pchanges)
res = salt.utils.state.merge_subreturn(m, s)
self.assertDictEqual(res['pchanges'], {
'secondary': secondary_pchanges
})
# Main pchanges, no sub pchanges
m = copy.deepcopy(self.main_ret)
m['pchanges'] = copy.deepcopy(primary_pchanges)
s = copy.deepcopy(self.sub_ret)
res = salt.utils.state.merge_subreturn(m, s)
self.assertDictEqual(res['pchanges'], primary_pchanges)
# Both main and sub pchanges, new pchanges don't affect existing ones
m = copy.deepcopy(self.main_ret)
m['pchanges'] = copy.deepcopy(primary_pchanges)
s = copy.deepcopy(self.sub_ret)
s['pchanges'] = copy.deepcopy(secondary_pchanges)
res = salt.utils.state.merge_subreturn(m, s)
self.assertDictEqual(res['pchanges'], {
'old': None,
'new': 'my_resource',
'secondary': secondary_pchanges,
})
# The subkey parameter is respected
m = copy.deepcopy(self.main_ret)
m['pchanges'] = copy.deepcopy(primary_pchanges)
s = copy.deepcopy(self.sub_ret)
s['pchanges'] = copy.deepcopy(secondary_pchanges)
res = salt.utils.state.merge_subreturn(m, s, subkey='alarms')
self.assertDictEqual(res['pchanges'], {
'old': None,
'new': 'my_resource',
'alarms': secondary_pchanges,
})
def test_merge_comments(self): def test_merge_comments(self):
main_comment_1 = 'First primary comment.' main_comment_1 = 'First primary comment.'
main_comment_2 = 'Second primary comment.' main_comment_2 = 'Second primary comment.'
sub_comment_1 = 'First secondary comment,\nwhich spans two lines.' sub_comment_1 = 'First secondary comment,\nwhich spans two lines.'
sub_comment_2 = 'Second secondary comment: {0}'.format( sub_comment_2 = 'Second secondary comment: {0}'.format(
'some error\n And a traceback', 'some error\n And a traceback',
) )
final_comment = textwrap.dedent('''\ final_comment = textwrap.dedent('''\
First primary comment. First primary comment.
Second primary comment. Second primary comment.
 End of changes. 1 change blocks. 
50 lines changed or deleted 0 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)