Example #1
0
    def test_find_hook(self):
        """Finds the specified hook."""
        with utils.work_in(self.repo_path):
            expected_pre = os.path.abspath("hooks/pre_gen_project.py")
            actual_hook_path = hooks.find_hook("pre_gen_project")
            assert expected_pre == actual_hook_path

            expected_post = os.path.abspath("hooks/{}".format(self.post_hook))
            actual_hook_path = hooks.find_hook("post_gen_project")
            assert expected_post == actual_hook_path
Example #2
0
    def test_find_hook(self):
        """Finds the specified hook."""
        with cookiecutter.utils.context_manager.work_in(self.repo_path):
            expected_pre = os.path.abspath('hooks/pre_gen_project.py')
            actual_hook_path = hooks.find_hook('pre_gen_project')
            assert expected_pre == actual_hook_path[0]

            expected_post = os.path.abspath('hooks/{}'.format(self.post_hook))
            actual_hook_path = hooks.find_hook('post_gen_project')
            assert expected_post == actual_hook_path[0]
Example #3
0
    def test_find_hook(self):
        """Finds the specified hook."""

        with utils.work_in(self.repo_path):
            expected_pre = os.path.abspath('hooks/pre_gen_project.py')
            actual_hook_path = hooks.find_hook('pre_gen_project')
            assert expected_pre == actual_hook_path

            expected_post = os.path.abspath('hooks/{}'.format(self.post_hook))
            actual_hook_path = hooks.find_hook('post_gen_project')
            assert expected_post == actual_hook_path
Example #4
0
 def test_no_hooks(self):
     """find_hooks should return None if the hook could not be found."""
     with utils.work_in("tests/fake-repo"):
         assert None is hooks.find_hook("pre_gen_project")
Example #5
0
def test_ignore_hook_backup_files(monkeypatch, dir_with_hooks):
    # Change the current working directory that contains `hooks/`
    monkeypatch.chdir(dir_with_hooks)
    assert hooks.find_hook("pre_gen_project") is None
    assert hooks.find_hook("post_gen_project") is None
Example #6
0
 def test_hook_not_found(self):
     """`find_hooks` should return None if the hook could not be found."""
     with utils.work_in(self.repo_path):
         assert hooks.find_hook('unknown_hook') is None
Example #7
0
 def test_unknown_hooks_dir(self):
     """`find_hooks` should return None if hook directory not found."""
     with utils.work_in(self.repo_path):
         assert hooks.find_hook('pre_gen_project',
                                hooks_dir='hooks_dir') is None
Example #8
0
 def test_no_hooks(self):
     """`find_hooks` should return None if the hook could not be found."""
     with utils.work_in('tests/fake-repo'):
         assert None is hooks.find_hook('pre_gen_project')
Example #9
0
 def test_no_hooks(self):
     """`find_hooks` should return None if the hook could not be found."""
     with cookiecutter.utils.context_manager.work_in(
             'tests/fixtures/fake-repo'):
         assert None is hooks.find_hook('pre_gen_project')
Example #10
0
 def test_hook_not_found(self):
     """`find_hooks` should return None if the hook could not be found."""
     with cookiecutter.utils.context_manager.work_in(self.repo_path):
         assert hooks.find_hook('unknown_hook') is None
Example #11
0
 def test_hook_not_found(self):
     with utils.work_in(self.repo_path):
         assert hooks.find_hook('unknown_hook') is None
Example #12
0
 def test_unknown_hooks_dir(self):
     with utils.work_in(self.repo_path):
         assert hooks.find_hook(
             'pre_gen_project',
             hooks_dir='hooks_dir'
         ) is None
Example #13
0
    def test_no_hooks(self):
        """find_hooks should return None if the hook could not be found."""

        with utils.work_in('tests/fake-repo'):
            assert None is hooks.find_hook('pre_gen_project')
Example #14
0
 def test_unknown_hooks_dir(self):
     with utils.work_in(self.repo_path):
         assert hooks.find_hook("pre_gen_project",
                                hooks_dir="hooks_dir") is None
Example #15
0
def test_ignore_hook_backup_files(monkeypatch, dir_with_hooks):
    """Test `find_hook` correctly use `valid_hook` verification function."""
    # Change the current working directory that contains `hooks/`
    monkeypatch.chdir(dir_with_hooks)
    assert hooks.find_hook('pre_gen_project') is None
    assert hooks.find_hook('post_gen_project') is None
Example #16
0
 def test_hook_not_found(self):
     with utils.work_in(self.repo_path):
         assert hooks.find_hook("unknown_hook") is None
Example #17
0
def test_ignore_hook_backup_files(monkeypatch, dir_with_hooks):
    # Change the current working directory that contains `hooks/`
    monkeypatch.chdir(dir_with_hooks)
    assert hooks.find_hook('pre_gen_project') is None
    assert hooks.find_hook('post_gen_project') is None