예제 #1
0
    def test_unlink_from_git_dir(self):
        current = CurrentView(repo="repo",
                              repo_path="repo_path",
                              ignore=CachedIgnore())

        with pytest.raises(FuseOSError):
            current.unlink(".git/")
예제 #2
0
    def test_unlink(self):
        from gitfs.views import current as current_view
        old_unlink = current_view.PassthroughView.unlink
        current_view.PassthroughView.unlink = lambda me, path: "done"

        mocked_index = MagicMock()

        current = CurrentView(repo="repo", uid=1, gid=1,
                              repo_path="repo_path",
                              ignore=CachedIgnore())
        current._stage = mocked_index

        assert current.unlink("/path") == "done"
        message = "Deleted /path"
        mocked_index.assert_called_once_with(remove="/path", message=message)

        current_view.PassthroughView.unlink = old_unlink
예제 #3
0
    def test_unlink(self):
        from gitfs.views import current as current_view
        old_unlink = current_view.PassthroughView.unlink
        current_view.PassthroughView.unlink = lambda me, path: "done"

        mocked_index = MagicMock()

        current = CurrentView(repo="repo", uid=1, gid=1,
                              repo_path="repo_path",
                              ignore=CachedIgnore())
        current._stage = mocked_index

        assert current.unlink("/path") == "done"
        message = "Deleted /path"
        mocked_index.assert_called_once_with(remove="/path", message=message)

        current_view.PassthroughView.unlink = old_unlink
예제 #4
0
    def test_unlink_from_git_dir(self):
        current = CurrentView(repo="repo", repo_path="repo_path",
                              ignore=CachedIgnore())

        with pytest.raises(FuseOSError):
            current.unlink(".git/")