test_svnfs.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # -*- coding: utf-8 -*-
  2. # Import Python libs
  3. from __future__ import absolute_import, print_function, unicode_literals
  4. # Import Salt Testing libs
  5. from tests.support.mixins import LoaderModuleMockMixin
  6. from tests.support.unit import TestCase
  7. from tests.support.mock import patch
  8. # Import Salt libs
  9. import salt.fileserver.svnfs as svnfs
  10. class SvnfsFileTest(TestCase, LoaderModuleMockMixin):
  11. def setup_loader_modules(self):
  12. return {
  13. svnfs: {}
  14. }
  15. def test_env_is_exposed(self):
  16. '''
  17. test _env_is_exposed method when
  18. base is in whitelist
  19. '''
  20. with patch.dict(svnfs.__opts__,
  21. {'svnfs_saltenv_whitelist': 'base',
  22. 'svnfs_saltenv_blacklist': ''}):
  23. assert svnfs._env_is_exposed('base')
  24. def test_env_is_exposed_blacklist(self):
  25. '''
  26. test _env_is_exposed method when
  27. base is in blacklist
  28. '''
  29. with patch.dict(svnfs.__opts__,
  30. {'svnfs_saltenv_whitelist': '',
  31. 'svnfs_saltenv_blacklist': 'base'}):
  32. assert not svnfs._env_is_exposed('base')