"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/unit/fileserver/test_roots.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_roots.py  (salt-2019.2.0):test_roots.py  (salt-2019.2.1)
skipping to change at line 155 skipping to change at line 155
{ {
'hsum': hsum, 'hsum': hsum,
'hash_type': 'sha256' 'hash_type': 'sha256'
} }
) )
def test_file_list_emptydirs(self): def test_file_list_emptydirs(self):
ret = roots.file_list_emptydirs({'saltenv': 'base'}) ret = roots.file_list_emptydirs({'saltenv': 'base'})
self.assertIn('empty_dir', ret) self.assertIn('empty_dir', ret)
def test_file_list_with_slash(self):
opts = {'file_roots': copy.copy(self.opts['file_roots'])}
opts['file_roots']['foo/bar'] = opts['file_roots']['base']
load = {
'saltenv': 'foo/bar',
}
with patch.dict(roots.__opts__, opts):
ret = roots.file_list(load)
self.assertIn('testfile', ret)
self.assertIn(UNICODE_FILENAME, ret)
def test_dir_list(self): def test_dir_list(self):
ret = roots.dir_list({'saltenv': 'base'}) ret = roots.dir_list({'saltenv': 'base'})
self.assertIn('empty_dir', ret) self.assertIn('empty_dir', ret)
self.assertIn(UNICODE_DIRNAME, ret) self.assertIn(UNICODE_DIRNAME, ret)
def test_symlink_list(self): def test_symlink_list(self):
orig_file_roots = self.opts['file_roots'] orig_file_roots = self.opts['file_roots']
try: try:
if self.test_symlink_list_file_roots: if self.test_symlink_list_file_roots:
self.opts['file_roots'] = self.test_symlink_list_file_roots self.opts['file_roots'] = self.test_symlink_list_file_roots
ret = roots.symlink_list({'saltenv': 'base'}) ret = roots.symlink_list({'saltenv': 'base'})
self.assertDictEqual(ret, {'dest_sym': 'source_sym'}) self.assertDictEqual(ret, {'dest_sym': 'source_sym'})
finally: finally:
if self.test_symlink_list_file_roots: if self.test_symlink_list_file_roots:
self.opts['file_roots'] = orig_file_roots self.opts['file_roots'] = orig_file_roots
def test_dynamic_file_roots(self):
dyn_root_dir = tempfile.mkdtemp(dir=TMP)
top_sls = os.path.join(dyn_root_dir, 'top.sls')
with salt.utils.files.fopen(top_sls, 'w') as fp_:
fp_.write("{{saltenv}}:\n '*':\n - dynamo\n")
dynamo_sls = os.path.join(dyn_root_dir, 'dynamo.sls')
with salt.utils.files.fopen(dynamo_sls, 'w') as fp_:
fp_.write("foo:\n test.nop\n")
opts = {'file_roots': copy.copy(self.opts['file_roots'])}
opts['file_roots']['__env__'] = [dyn_root_dir]
with patch.dict(roots.__opts__, opts):
ret1 = roots.find_file('dynamo.sls', 'dyn')
ret2 = roots.file_list({'saltenv': 'dyn'})
self.assertEqual('dynamo.sls', ret1['rel'])
self.assertIn('top.sls', ret2)
self.assertIn('dynamo.sls', ret2)
 End of changes. 2 change blocks. 
0 lines changed or deleted 11 lines changed or added

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