Beispiel #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())
Beispiel #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())
Beispiel #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())
Beispiel #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() == {}
Beispiel #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() == {}
Beispiel #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())
Beispiel #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())
    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()
Beispiel #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()
Beispiel #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()
Beispiel #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())
Beispiel #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() == {}
Beispiel #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() == {}