salt/tests/unit/config_test.py
Pedro Algarvio 759d67ffc0 Reverted back the --key-logfile deprecation.
On the parsers cleanup branch, I though about making the available options as equal as possible. Since the log_file setting for the master and the minion could be separately set,  I made the logfile option for the key also log_file. Yet, since there's no key specific config file, it shares master, one could only specify the log_file settings from the cli,   it could not be hardcoded on the config file, unless, we made a separate config file just for key.
So, in order to reduce required changes, and keep it all as backwards compatible as possible, the key log file options is now, once again, `--key-logfile` which will allow us to   hardcode it in the masters config file as `key_logfile`.
This will also, hopefully make travis behave better too.
2012-08-08 01:08:38 +01:00

32 lines
947 B
Python

# -*- coding: utf-8 -*-
"""
tests.unit.config
~~~~~~~~~~~~~~~~~
:copyright: © 2012 UfSoft.org - :email:`Pedro Algarvio (pedro@algarvio.me)`
:license: Apache 2.0, see LICENSE for more details.
"""
import os
import tempfile
from saltunittest import TestCase, TestLoader, TextTestRunner
from salt import config as sconfig
class ConfigTestCase(TestCase):
def test_proper_path_joining(self):
fpath = tempfile.mktemp()
open(fpath, 'w').write(
"root_dir: /\n"
"key_logfile: key\n"
)
config = sconfig.master_config(fpath)
# os.path.join behaviour
self.assertEqual(config['key_logfile'], os.path.join('/', 'key'))
# os.sep.join behaviour
self.assertNotEqual(config['key_logfile'], '//key')
if __name__ == "__main__":
loader = TestLoader()
tests = loader.loadTestsFromTestCase(ConfigTestCase)
TextTestRunner(verbosity=1).run(tests)