Пример #1
0
 def test_envs(self):
     with patch.dict(gitfs.__opts__, {'cachedir': self.master_opts['cachedir'],
                                      'gitfs_remotes': ['file://' + self.tmp_repo_dir],
                                      'sock_dir': self.master_opts['sock_dir'],
                                      '__role': self.master_opts['__role']}):
         ret = gitfs.envs()
         self.assertIn('base', ret)
Пример #2
0
 def test_disable_saltenv_mapping_per_remote_with_mapping_defined_per_remote(
         self):
     """
     Test the per-remote disable_saltenv_mapping config option, combined
     with the per-saltenv mapping being defined in the remote itself via the
     "saltenv" per-remote option.
     """
     opts = salt.utils.yaml.safe_load(
         textwrap.dedent("""\
         gitfs_remotes:
           - {0}:
             - disable_saltenv_mapping: True
             - saltenv:
               - world:
                 - ref: somebranch
         """.format(self.tmp_repo_dir)))
     with patch.dict(gitfs.__opts__, opts):
         gitfs.update()
         ret = gitfs.envs(ignore_cache=True)
         # Since we are restricting to tags only, the tag should appear in
         # the envs list, but the branches should not.
         self.assertEqual(ret, ["base", "world"])
Пример #3
0
 def test_disable_saltenv_mapping_global_with_mapping_defined_globally(self):
     """
     Test the global gitfs_disable_saltenv_mapping config option, combined
     with the per-saltenv mapping being defined in the global gitfs_saltenv
     option.
     """
     opts = salt.utils.yaml.safe_load(
         textwrap.dedent(
             """\
         gitfs_disable_saltenv_mapping: True
         gitfs_saltenv:
           - foo:
             - ref: somebranch
         """
         )
     )
     with patch.dict(gitfs.__opts__, opts):
         gitfs.update()
         ret = gitfs.envs(ignore_cache=True)
         # Since we are restricting to tags only, the tag should appear in
         # the envs list, but the branches should not.
         self.assertEqual(ret, ["base", "foo"])