Ejemplo n.º 1
0
    def test_required_files_only_copied_if_exist(self, copy, isfile):
        self.testmod.REQUIRED_FILES = ['should_be_copied']
        isfile.return_value = False

        pre_commit.main()

        self.assertEquals(0, copy.call_count)
Ejemplo n.º 2
0
    def test_required_files_only_copied_if_exist(self, copy, isfile):
        self.testmod.REQUIRED_FILES = ['should_be_copied']
        isfile.return_value = False

        pre_commit.main()

        self.assertEquals(0, copy.call_count)
Ejemplo n.º 3
0
    def test_required_files(self, copy, isfile):
        self.testmod.REQUIRED_FILES = ['should_be_copied']
        isfile.return_value = True

        pre_commit.main()

        copy.assert_called_with('should_be_copied', ANY)
Ejemplo n.º 4
0
    def test_required_files(self, copy, isfile):
        self.testmod.REQUIRED_FILES = ['should_be_copied']
        isfile.return_value = True

        pre_commit.main()

        copy.assert_called_with('should_be_copied', ANY)
Ejemplo n.º 5
0
    def test_calling_run_with_args(self):
        self.HookConfig().arguments.return_value = 'yep'

        result = pre_commit.main()

        self.assertEquals(result, 0)
        self.testmod.run.assert_called_with(['file_one'], '/tmp/dir', 'yep')
Ejemplo n.º 6
0
    def test_calling_run_with_args(self):
        self.HookConfig().arguments.return_value = 'yep'

        result = pre_commit.main()

        self.assertEquals(result, 0)
        self.testmod.run.assert_called_with(['file_one'], '/tmp/dir', 'yep')
Ejemplo n.º 7
0
    def test_calling_run_without_args(self, checks, HookConfig):
        HookConfig().is_enabled.return_value = True
        HookConfig().arguments.return_value = ''
        testmod = Mock()
        testmod.run.return_value = None

        checks.return_value = [("testmod", testmod)]

        result = pre_commit.main()

        self.assertEquals(result, 0)
        testmod.run.assert_called_with()
Ejemplo n.º 8
0
    def test_calling_run_without_args(self, checks, HookConfig):
        HookConfig().is_enabled.return_value = True
        HookConfig().arguments.return_value = ''
        testmod = Mock()
        testmod.run.return_value = None

        checks.return_value = [("testmod", testmod)]

        result = pre_commit.main()

        self.assertEquals(result, 0)
        testmod.run.assert_called_with()
Ejemplo n.º 9
0
    def test_calling_run_without_args(self):
        result = pre_commit.main()

        self.assertEquals(result, 0)
        self.testmod.run.assert_called_with(['/tmp/dir/file_one'], '/tmp/dir')
Ejemplo n.º 10
0
    def test_calling_run_without_args(self):
        result = pre_commit.main()

        self.assertEquals(result, 0)
        self.testmod.run.assert_called_with(['file_one'], '/tmp/dir')