Move tests to existing test modules

This commit is contained in:
Pedro Algarvio 2019-05-09 13:41:07 +01:00
parent 46816092eb
commit 8e505fb91a
No known key found for this signature in database
GPG key ID: BB36BF6584A298FF
2 changed files with 18 additions and 32 deletions

View file

@ -1,32 +0,0 @@
# -*- coding: utf-8 -*-
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt Testing Libs
from tests.support.unit import TestCase, skipIf
import tests.support.mock as mock
import salt.config
import salt.syspaths
class ConfigTest(TestCase):
def test_validate_bad_pillar_roots(self):
expected = salt.config._expand_glob_path(
[salt.syspaths.BASE_PILLAR_ROOTS_DIR]
)
with mock.patch('salt.config._normalize_roots') as mk:
ret = salt.config._validate_pillar_roots(None)
assert not mk.called
assert ret == {'base': expected}
def test_validate_bad_file_roots(self):
expected = salt.config._expand_glob_path(
[salt.syspaths.BASE_FILE_ROOTS_DIR]
)
with mock.patch('salt.config._normalize_roots') as mk:
ret = salt.config._validate_file_roots(None)
assert not mk.called
assert ret == {'base': expected}

View file

@ -560,6 +560,15 @@ class ConfigTestCase(TestCase, AdaptedConfigurationTestCaseMixin):
os.path.join(tempdir, 'c')
]))
def test_validate_bad_file_roots(self):
expected = salt.config._expand_glob_path(
[salt.syspaths.BASE_FILE_ROOTS_DIR]
)
with mock.patch('salt.config._normalize_roots') as mk:
ret = salt.config._validate_file_roots(None)
assert not mk.called
assert ret == {'base': expected}
@with_tempfile()
@with_tempdir()
def test_master_pillar_roots_glob(self, tempdir, fpath):
@ -583,6 +592,15 @@ class ConfigTestCase(TestCase, AdaptedConfigurationTestCaseMixin):
os.path.join(tempdir, 'c')
]))
def test_validate_bad_pillar_roots(self):
expected = salt.config._expand_glob_path(
[salt.syspaths.BASE_PILLAR_ROOTS_DIR]
)
with mock.patch('salt.config._normalize_roots') as mk:
ret = salt.config._validate_pillar_roots(None)
assert not mk.called
assert ret == {'base': expected}
@with_tempdir()
def test_master_id_function(self, tempdir):
master_config = os.path.join(tempdir, 'master')