def test_ordered_merge(self): ''' Test to see if the merger respects environment ordering ''' config = self._make_default_config() config['top_file_merging_strategy'] = 'merge' config['env_order'] = ['b', 'a', 'c'] with patch('salt.fileclient.FSClient.envs', MagicMock(return_value=['a', 'b', 'c'])): highstate = HighState(config) ret = highstate.get_tops() self.assertEqual(ret, OrderedDict([('a', [{}]), ('c', [{}]), ('b', [{}])]))
def test_merge_strategy_same(self): ''' Test to see if the top file that corresponds to the requested env is the one that is used by the state system ''' config = self._make_default_config() config['top_file_merging_strategy'] = 'same' config['environment'] = 'b' highstate = HighState(config) ret = highstate.get_tops() self.assertEqual(ret, OrderedDict([('b', [{}])]))