Ejemplo n.º 1
0
    def test_dont_install_in_non_git(self):
        assert_that(not install())

        for hook in self.hooks:
            filename = os.path.join(self.path, HOOK_PATH, hook)
            assert_that(not os.path.exists(filename), filename)

        assert_that(not uninstall())
Ejemplo n.º 2
0
    def test_dont_install_in_non_git(self):
        assert_that(not install())

        for hook in self.hooks:
            filename = os.path.join(self.path, HOOK_PATH, hook)
            assert_that(not os.path.exists(filename), filename)

        assert_that(not uninstall())
Ejemplo n.º 3
0
    def test_install_hooks_and_overrides(self):
        precommit = os.path.join(HOOK_PATH, "pre-commit")
        self.call("git", "init")
        self.call("touch", precommit)

        assert_that(install(force=True))

        for hook in self.hooks:
            filename = os.path.join(self.path, HOOK_PATH, hook)
            assert_that(os.path.exists(filename), filename)

        with open(precommit, "r") as f:
            assert_that(f.read(), is_not(has_length(0)),
                        "precommit should have been overridden")

        assert_that(uninstall())

        for hook in self.hooks:
            filename = os.path.join(self.path, HOOK_PATH, hook)
            assert_that(not os.path.exists(filename), filename)
Ejemplo n.º 4
0
    def test_install_hooks(self):
        precommit = os.path.join(HOOK_PATH, "pre-commit")
        self.call("git", "init")
        self.call("touch", precommit)

        assert_that(install())

        for hook in self.hooks:
            filename = os.path.join(self.path, HOOK_PATH, hook)
            assert_that(os.path.exists(filename), filename)

        with open(precommit, "r") as f:
            assert_that(f.read(), has_length(0),
                        "precommit should be have been left as is")

        assert_that(uninstall())

        for hook in self.hooks:
            filename = os.path.join(self.path, HOOK_PATH, hook)
            assert_that(not os.path.exists(filename), filename)
Ejemplo n.º 5
0
    def test_install_hooks_and_overrides(self):
        precommit = os.path.join(HOOK_PATH, "pre-commit")
        self.call("git", "init")
        self.call("touch", precommit)

        assert_that(install(force=True))

        for hook in self.hooks:
            filename = os.path.join(self.path, HOOK_PATH, hook)
            assert_that(os.path.exists(filename), filename)

        with open(precommit, "r") as f:
            assert_that(f.read(), is_not(has_length(0)),
                        "precommit should have been overridden")

        assert_that(uninstall())

        for hook in self.hooks:
            filename = os.path.join(self.path, HOOK_PATH, hook)
            assert_that(not os.path.exists(filename), filename)
Ejemplo n.º 6
0
    def test_install_hooks(self):
        precommit = os.path.join(HOOK_PATH, "pre-commit")
        self.call("git", "init")
        self.call("touch", precommit)

        assert_that(install())

        for hook in self.hooks:
            filename = os.path.join(self.path, HOOK_PATH, hook)
            assert_that(os.path.exists(filename), filename)

        with open(precommit, "r") as f:
            assert_that(f.read(), has_length(0),
                        "precommit should be have been left as is")

        assert_that(uninstall())

        for hook in self.hooks:
            filename = os.path.join(self.path, HOOK_PATH, hook)
            assert_that(not os.path.exists(filename), filename)