def test_create_in_git_dir(self): current = CurrentView(repo="repo", uid=1, gid=1, repo_path="repo_path", ignore=CachedIgnore()) with pytest.raises(FuseOSError): current.create(".git/", "mode")
def test_create_in_git_dir(self): current = CurrentView(repo="repo", uid=1, gid=1, repo_path="repo_path", ignore=CachedIgnore()) with pytest.raises(FuseOSError): current.create(".git/", "mode")
def test_create(self): from gitfs.views import current as current_view old_chmod = current_view.PassthroughView.chmod mock_chmod = lambda self, path, mode: "done" current_view.PassthroughView.chmod = mock_chmod mocked_open = MagicMock() mocked_open.return_value = "done" current = CurrentView(repo="repo", uid=1, gid=1, repo_path="repo_path", ignore=CachedIgnore()) current.dirty = {'/path': {'content': "here"}} current.open_for_write = mocked_open assert current.create("/path", "mode") == "done" current_view.PassthroughView.chmod = old_chmod
def test_create(self): from gitfs.views import current as current_view old_chmod = current_view.PassthroughView.chmod mock_chmod = lambda self, path, mode: "done" current_view.PassthroughView.chmod = mock_chmod mocked_open = MagicMock() mocked_open.return_value = "done" current = CurrentView(repo="repo", uid=1, gid=1, repo_path="repo_path", ignore=CachedIgnore()) current.dirty = { '/path': { 'content': "here" } } current.open_for_write = mocked_open assert current.create("/path", "mode") == "done" current_view.PassthroughView.chmod = old_chmod