-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55552 from Ch3LL/issue_49426
Deprecate hgfs/svnfs_env_whitelist/blacklist
- Loading branch information
Showing
7 changed files
with
96 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Import Python libs | ||
from __future__ import absolute_import, print_function, unicode_literals | ||
|
||
# Import Salt Testing libs | ||
from tests.support.mixins import LoaderModuleMockMixin | ||
from tests.support.unit import TestCase | ||
from tests.support.mock import patch | ||
|
||
# Import Salt libs | ||
import salt.fileserver.hgfs as hgfs | ||
|
||
|
||
class HgfsFileTest(TestCase, LoaderModuleMockMixin): | ||
def setup_loader_modules(self): | ||
return { | ||
hgfs: {} | ||
} | ||
|
||
def test_env_is_exposed(self): | ||
''' | ||
test _env_is_exposed method when | ||
base is in whitelist | ||
''' | ||
with patch.dict(hgfs.__opts__, | ||
{'hgfs_saltenv_whitelist': 'base', | ||
'hgfs_saltenv_blacklist': ''}): | ||
assert hgfs._env_is_exposed('base') | ||
|
||
def test_env_is_exposed_blacklist(self): | ||
''' | ||
test _env_is_exposed method when | ||
base is in blacklist | ||
''' | ||
with patch.dict(hgfs.__opts__, | ||
{'hgfs_saltenv_whitelist': '', | ||
'hgfs_saltenv_blacklist': 'base'}): | ||
assert not hgfs._env_is_exposed('base') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Import Python libs | ||
from __future__ import absolute_import, print_function, unicode_literals | ||
|
||
# Import Salt Testing libs | ||
from tests.support.mixins import LoaderModuleMockMixin | ||
from tests.support.unit import TestCase | ||
from tests.support.mock import patch | ||
|
||
# Import Salt libs | ||
import salt.fileserver.svnfs as svnfs | ||
|
||
|
||
class SvnfsFileTest(TestCase, LoaderModuleMockMixin): | ||
def setup_loader_modules(self): | ||
return { | ||
svnfs: {} | ||
} | ||
|
||
def test_env_is_exposed(self): | ||
''' | ||
test _env_is_exposed method when | ||
base is in whitelist | ||
''' | ||
with patch.dict(svnfs.__opts__, | ||
{'svnfs_saltenv_whitelist': 'base', | ||
'svnfs_saltenv_blacklist': ''}): | ||
assert svnfs._env_is_exposed('base') | ||
|
||
def test_env_is_exposed_blacklist(self): | ||
''' | ||
test _env_is_exposed method when | ||
base is in blacklist | ||
''' | ||
with patch.dict(svnfs.__opts__, | ||
{'svnfs_saltenv_whitelist': '', | ||
'svnfs_saltenv_blacklist': 'base'}): | ||
assert not svnfs._env_is_exposed('base') |