salt/tests/integration/modules/test_test.py

96 lines
2.2 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.mixins import AdaptedConfigurationTestCaseMixin
# Import salt libs
2014-12-15 20:13:42 +00:00
import salt.version
import salt.config
class TestModuleTest(ModuleCase, AdaptedConfigurationTestCaseMixin):
2012-02-12 09:05:35 +00:00
'''
Validate the test module
'''
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
'''
self.assertEqual(self.run_function('test.version'),
2014-12-15 20:13:42 +00:00
salt.version.__saltstack_version__.string)
2012-02-13 21:32:11 +00:00
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
'''
opts = salt.config.minion_config(
self.get_config_file_path('minion')
)
2012-02-13 21:32:11 +00:00
self.assertEqual(
self.run_function('test.get_opts')['cachedir'],
opts['cachedir']
)
2012-02-13 21:32:11 +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',
2015-04-11 18:48:48 +00:00
['20'],
)[0],
6765
2012-02-13 21:32:11 +00:00
)
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')