salt/tests/integration/runners/fileserver.py
Erik Johnson d71e9de859 Fix test_envs fileserver runner test
The change in runner output behavior caused the output of test_envs to
change, causing some changes to need to be made in da163471 to get them
to pass. Now that runner output is fixed, the test was returning the
output it should have been in the first place. This commit changes that
test back so that it now expects a list as output.

Additionally, I've taken the opportunity to add additional test calls to
test the "backend" argument for those functions which now have it.
2015-03-10 11:28:59 -05:00

124 lines
3.9 KiB
Python

# -*- coding: utf-8 -*-
'''
Tests for the fileserver runner
'''
# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
class ManageTest(integration.ShellCase):
'''
Test the fileserver runner
'''
def test_dir_list(self):
'''
fileserver.dir_list
'''
ret = self.run_run_plus(fun='fileserver.dir_list')
self.assertIsInstance(ret['fun'], list)
# Backend submitted as a string
ret = self.run_run_plus(fun='fileserver.dir_list',
args=['backend="roots"'])
self.assertIsInstance(ret['fun'], list)
# Backend submitted as a list
ret = self.run_run_plus(fun='fileserver.dir_list',
args=['backend="[roots]"'])
self.assertIsInstance(ret['fun'], list)
def test_empty_dir_list(self):
'''
fileserver.empty_dir_list
'''
ret = self.run_run_plus(fun='fileserver.empty_dir_list')
self.assertIsInstance(ret['fun'], list)
# Backend submitted as a string
ret = self.run_run_plus(fun='fileserver.empty_dir_list',
args=['backend="roots"'])
self.assertIsInstance(ret['fun'], list)
# Backend submitted as a list
ret = self.run_run_plus(fun='fileserver.empty_dir_list',
args=['backend="[roots]"'])
self.assertIsInstance(ret['fun'], list)
def test_envs(self):
'''
fileserver.envs
'''
ret = self.run_run_plus(fun='fileserver.envs')
self.assertIsInstance(ret['fun'], list)
# Backend submitted as a string
ret = self.run_run_plus(fun='fileserver.envs',
args=['backend="roots"'])
self.assertIsInstance(ret['fun'], list)
# Backend submitted as a list
ret = self.run_run_plus(fun='fileserver.envs',
args=['backend="[roots]"'])
self.assertIsInstance(ret['fun'], list)
def test_file_list(self):
'''
fileserver.file_list
'''
ret = self.run_run_plus(fun='fileserver.file_list')
self.assertIsInstance(ret['fun'], list)
# Backend submitted as a string
ret = self.run_run_plus(fun='fileserver.file_list',
args=['backend="roots"'])
self.assertIsInstance(ret['fun'], list)
# Backend submitted as a list
ret = self.run_run_plus(fun='fileserver.file_list',
args=['backend="[roots]"'])
self.assertIsInstance(ret['fun'], list)
def test_symlink_list(self):
'''
fileserver.symlink_list
'''
ret = self.run_run_plus(fun='fileserver.symlink_list')
self.assertIsInstance(ret['fun'], dict)
# Backend submitted as a string
ret = self.run_run_plus(fun='fileserver.symlink_list',
args=['backend="roots"'])
self.assertIsInstance(ret['fun'], dict)
# Backend submitted as a list
ret = self.run_run_plus(fun='fileserver.symlink_list',
args=['backend="[roots]"'])
self.assertIsInstance(ret['fun'], dict)
def test_update(self):
'''
fileserver.update
'''
ret = self.run_run_plus(fun='fileserver.update')
self.assertTrue(ret['fun'])
# Backend submitted as a string
ret = self.run_run_plus(fun='fileserver.update',
args=['backend="roots"'])
self.assertTrue(ret['fun'])
# Backend submitted as a list
ret = self.run_run_plus(fun='fileserver.update',
args=['backend="[roots]"'])
self.assertTrue(ret['fun'])
if __name__ == '__main__':
from integration import run_tests
run_tests(ManageTest)