mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
759d67ffc0
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.
32 lines
947 B
Python
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) |