Ejemplo n.º 1
0
 def test_find_hook(self):
     """Finds the specified hook"""
     with utils.work_in(self.repo_path):
         self.assertEqual({
             'pre_gen_project': os.path.abspath('hooks/pre_gen_project.py'),
             'post_gen_project': os.path.abspath(os.path.join('hooks', self.post_hook)),
         }, hooks.find_hooks())
Ejemplo n.º 2
0
 def test_find_hooks(self):
     '''Getting the list of all defined hooks'''
     with utils.work_in(self.repo_path):
         self.assertEqual({
             'pre_gen_project': os.path.abspath('hooks/pre_gen_project.py'),
             'post_gen_project': os.path.abspath(os.path.join('hooks', self.post_hook)),
         }, hooks.find_hooks())
Ejemplo n.º 3
0
 def test_find_hooks(self):
     '''Getting the list of all defined hooks'''
     repo_path = 'tests/test-hooks/'
     with utils.work_in(repo_path):
         self.assertEqual({
             'pre_gen_project': os.path.abspath('hooks/pre_gen_project.py'),
             'post_gen_project': os.path.abspath('hooks/post_gen_project.sh'),
         }, hooks.find_hooks())
Ejemplo n.º 4
0
def test_ignore_hook_backup_files(monkeypatch, hook_backup_files):
    # This makes sure that the files are actually in the directory
    assert hook_backup_files == [
        'post_gen_project.py~',
        'pre_gen_project.py~',
    ]

    monkeypatch.chdir('tests/hooks-backup-files/')
    assert hooks.find_hooks() == {}
Ejemplo n.º 5
0
def test_ignore_hook_backup_files(monkeypatch, hook_backup_files):
    # This makes sure that the files are actually in the directory
    assert hook_backup_files == [
        'post_gen_project.py~',
        'pre_gen_project.py~',
    ]

    monkeypatch.chdir('tests/hooks-backup-files/')
    assert hooks.find_hooks() == {}
Ejemplo n.º 6
0
 def test_find_hooks(self):
     '''Getting the list of all defined hooks'''
     with utils.work_in(self.repo_path):
         self.assertEqual(
             {
                 'pre_gen_project':
                 os.path.abspath('hooks/pre_gen_project.py'),
                 'post_gen_project':
                 os.path.abspath(os.path.join('hooks', self.post_hook)),
             }, hooks.find_hooks())
Ejemplo n.º 7
0
 def test_find_hook(self):
     """Finds the specified hook"""
     with utils.work_in(self.repo_path):
         self.assertEqual(
             {
                 'pre_gen_project':
                 os.path.abspath('hooks/pre_gen_project.py'),
                 'post_gen_project':
                 os.path.abspath(os.path.join('hooks', self.post_hook)),
             }, hooks.find_hooks())
Ejemplo n.º 8
0
    def test_find_hook(self):
        """Finds the specified hook."""

        with utils.work_in(self.repo_path):
            expected = {
                'pre_gen_project': [os.path.abspath(
                    'hooks/pre_gen_project.py'
                )],
                'post_gen_project': [os.path.abspath(
                    os.path.join('hooks', self.post_hook)
                )],
            }
            assert expected == hooks.find_hooks()
Ejemplo n.º 9
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 {} == hooks.find_hooks()
Ejemplo n.º 10
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 {} == hooks.find_hooks()
Ejemplo n.º 11
0
 def test_no_hooks(self):
     '''find_hooks should return an empty dict if no hooks folder could be found. '''
     with utils.work_in('tests/fake-repo'):
         self.assertEqual({}, hooks.find_hooks())
Ejemplo n.º 12
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_hooks() == {}
Ejemplo n.º 13
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_hooks() == {}