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 libs
  5. import salt.fileserver.svnfs as svnfs
  6. # Import Salt Testing libs
  7. from tests.support.mixins import LoaderModuleMockMixin
  8. from tests.support.mock import patch
  9. from tests.support.unit import TestCase
  10. class SvnfsFileTest(TestCase, LoaderModuleMockMixin):
  11. def setup_loader_modules(self):
  12. return {svnfs: {}}
  13. def test_env_is_exposed(self):
  14. """
  15. test _env_is_exposed method when
  16. base is in whitelist
  17. """
  18. with patch.dict(
  19. svnfs.__opts__,
  20. {"svnfs_saltenv_whitelist": "base", "svnfs_saltenv_blacklist": ""},
  21. ):
  22. assert svnfs._env_is_exposed("base")
  23. def test_env_is_exposed_blacklist(self):
  24. """
  25. test _env_is_exposed method when
  26. base is in blacklist
  27. """
  28. with patch.dict(
  29. svnfs.__opts__,
  30. {"svnfs_saltenv_whitelist": "", "svnfs_saltenv_blacklist": "base"},
  31. ):
  32. assert not svnfs._env_is_exposed("base")