2013-11-27 11:19:24 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2014-11-21 19:05:13 +00:00
|
|
|
# Import Python libs
|
|
|
|
from __future__ import absolute_import
|
|
|
|
|
2013-06-27 11:53:56 +00:00
|
|
|
# Import Salt Testing libs
|
2017-04-03 16:04:09 +00:00
|
|
|
from tests.support.case import ModuleCase
|
|
|
|
from tests.support.mixins import AdaptedConfigurationTestCaseMixin
|
2013-06-27 11:53:56 +00:00
|
|
|
|
|
|
|
# Import salt libs
|
2014-12-15 20:13:42 +00:00
|
|
|
import salt.version
|
2017-02-27 15:59:04 +00:00
|
|
|
import salt.config
|
2012-05-05 14:09:23 +00:00
|
|
|
|
2011-12-22 01:36:26 +00:00
|
|
|
|
2017-04-03 16:04:09 +00:00
|
|
|
class TestModuleTest(ModuleCase, AdaptedConfigurationTestCaseMixin):
|
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
|
|
|
|
'''
|
2014-06-14 21:42:01 +00:00
|
|
|
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
|
|
|
|
'''
|
2017-02-27 15:59:04 +00:00
|
|
|
opts = salt.config.minion_config(
|
2014-06-14 21:42:01 +00:00
|
|
|
self.get_config_file_path('minion')
|
|
|
|
)
|
2012-02-13 21:32:11 +00:00
|
|
|
self.assertEqual(
|
2014-06-14 21:42:01 +00:00
|
|
|
self.run_function('test.get_opts')['cachedir'],
|
|
|
|
opts['cachedir']
|
|
|
|
)
|
2012-02-13 21:32:11 +00:00
|
|
|
|
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',
|
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')
|