Skip to content

Commit

Permalink
tests/unit/config/__init__.py -> tests/unit/config/test_config.py
Browse files Browse the repository at this point in the history
No top level `__init__.py` should contain tests
  • Loading branch information
s0undt3ch committed May 9, 2019
1 parent 3e9d22a commit c4ed698
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 31 deletions.
31 changes: 0 additions & 31 deletions tests/unit/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,32 +1 @@
# -*- 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}
32 changes: 32 additions & 0 deletions tests/unit/config/test_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# -*- 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}

0 comments on commit c4ed698

Please sign in to comment.