salt/tests/integration/loader.py

47 lines
1.2 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2013 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
integration.loader
~~~~~~~~~~~~~~~~~~
Test Salt's loader
'''
# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../')
# Import salt libs
import integration
class LoaderTest(integration.ModuleCase):
2013-10-26 17:45:21 +00:00
def test_overridden_internam_module_funcis(self):
funcs = self.run_function('sys.list_functions')
# We placed a test module under _modules.
2013-10-26 17:45:21 +00:00
# The previous functions should also still exist.
self.assertIn('test.ping', funcs)
# A non existing function should, of course, not exist
self.assertNotIn('brain.left_hemisphere', funcs)
# There should be a new function for the test module, recho
self.assertIn('test.recho', funcs)
2013-10-26 17:45:21 +00:00
text = 'foo bar baz quo qux'
self.assertEqual(
self.run_function('test.echo', arg=[text])[::-1],
self.run_function('test.recho', arg=[text]),
)
if __name__ == '__main__':
from integration import run_tests
run_tests(LoaderTest)