Beispiel #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
Beispiel #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]
Beispiel #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
Beispiel #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")
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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')
Beispiel #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')
Beispiel #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
Beispiel #11
0
 def test_hook_not_found(self):
     with utils.work_in(self.repo_path):
         assert hooks.find_hook('unknown_hook') is None
Beispiel #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
Beispiel #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')
Beispiel #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
Beispiel #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
Beispiel #16
0
 def test_hook_not_found(self):
     with utils.work_in(self.repo_path):
         assert hooks.find_hook("unknown_hook") is None
Beispiel #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