2012-02-13 21:32:11 +00:00
|
|
|
# Import python libs
|
|
|
|
import os
|
2013-06-27 11:53:56 +00:00
|
|
|
|
|
|
|
# Import Salt Testing libs
|
|
|
|
from salttesting.helpers import ensure_in_syspath
|
|
|
|
ensure_in_syspath('../../')
|
|
|
|
|
|
|
|
# Import salt libs
|
|
|
|
import integration
|
2012-05-05 14:09:23 +00:00
|
|
|
|
2011-12-22 01:36:26 +00:00
|
|
|
|
2012-02-20 12:18:13 +00:00
|
|
|
class TestModuleTest(integration.ModuleCase):
|
2012-02-12 09:05:35 +00:00
|
|
|
'''
|
|
|
|
Validate the test module
|
|
|
|
'''
|
2011-12-22 01:36:26 +00:00
|
|
|
def test_ping(self):
|
2012-02-12 09:05:35 +00:00
|
|
|
'''
|
|
|
|
test.ping
|
|
|
|
'''
|
|
|
|
self.assertTrue(self.run_function('test.ping'))
|
2012-02-12 23:34:42 +00:00
|
|
|
|
|
|
|
def test_echo(self):
|
|
|
|
'''
|
|
|
|
test.echo
|
|
|
|
'''
|
|
|
|
self.assertEqual(self.run_function('test.echo', ['text']), 'text')
|
2012-02-13 21:32:11 +00:00
|
|
|
|
|
|
|
def test_version(self):
|
|
|
|
'''
|
|
|
|
test.version
|
|
|
|
'''
|
|
|
|
import salt
|
|
|
|
self.assertEqual(self.run_function('test.version'), salt.__version__)
|
|
|
|
|
|
|
|
def test_conf_test(self):
|
|
|
|
'''
|
|
|
|
test.conf_test
|
|
|
|
'''
|
|
|
|
self.assertEqual(self.run_function('test.conf_test'), 'baz')
|
|
|
|
|
|
|
|
def test_get_opts(self):
|
|
|
|
'''
|
|
|
|
test.get_opts
|
|
|
|
'''
|
|
|
|
import salt.config
|
|
|
|
opts = salt.config.minion_config(
|
|
|
|
os.path.join(
|
2012-02-20 12:18:13 +00:00
|
|
|
integration.INTEGRATION_TEST_DIR,
|
2012-02-13 21:32:11 +00:00
|
|
|
'files/conf/minion'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
self.assertEqual(
|
|
|
|
self.run_function('test.get_opts')['cachedir'],
|
|
|
|
opts['cachedir']
|
|
|
|
)
|
|
|
|
|
2012-02-13 21:36:14 +00:00
|
|
|
def test_cross_test(self):
|
|
|
|
'''
|
|
|
|
test.cross_test
|
|
|
|
'''
|
|
|
|
self.assertTrue(
|
|
|
|
self.run_function(
|
|
|
|
'test.cross_test',
|
|
|
|
['test.ping']
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2012-02-13 21:32:11 +00:00
|
|
|
def test_fib(self):
|
|
|
|
'''
|
|
|
|
test.fib
|
|
|
|
'''
|
|
|
|
self.assertEqual(
|
|
|
|
self.run_function(
|
|
|
|
'test.fib',
|
|
|
|
['40'],
|
|
|
|
)[0][-1],
|
|
|
|
34
|
|
|
|
)
|
|
|
|
|
|
|
|
def test_collatz(self):
|
|
|
|
'''
|
|
|
|
test.collatz
|
|
|
|
'''
|
|
|
|
self.assertEqual(
|
|
|
|
self.run_function(
|
2012-03-10 15:27:38 +00:00
|
|
|
'test.collatz',
|
2012-02-13 21:32:11 +00:00
|
|
|
['40'],
|
|
|
|
)[0][-1],
|
2012-03-10 15:27:38 +00:00
|
|
|
2
|
2012-02-13 21:32:11 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
def test_outputter(self):
|
|
|
|
'''
|
|
|
|
test.outputter
|
|
|
|
'''
|
|
|
|
self.assertEqual(self.run_function('test.outputter', ['text']), 'text')
|
2012-05-05 14:09:23 +00:00
|
|
|
|
2012-07-20 06:21:01 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
from integration import run_tests
|
|
|
|
run_tests(TestModuleTest)
|