Skip to content

Commit

Permalink
removed root param from listdir (#31)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
  • Loading branch information
bigcat88 authored Jul 13, 2023
1 parent eb692aa commit 552d03e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
4 changes: 2 additions & 2 deletions nc_py_api/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ class FilesAPI:
def __init__(self, session: NcSessionBasic):
self._session = session

def listdir(self, path="", exclude_self=True, root=False) -> list[FsNode]:
def listdir(self, path="", exclude_self=True) -> list[FsNode]:
properties = PROPFIND_PROPERTIES
return self._listdir("" if root else self._session.user, path, properties=properties, exclude_self=exclude_self)
return self._listdir(self._session.user, path, properties=properties, exclude_self=exclude_self)

def by_id(self, fileid: int) -> Optional[FsNode]:
result = self.find(req=["eq", "fileid", fileid])
Expand Down
10 changes: 1 addition & 9 deletions tests/files_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ def write(self, *args, **kwargs):
return super().write(*args, **kwargs)


@pytest.mark.parametrize("nc", NC_TO_TEST)
def test_list_root(nc):
files_root = nc.files.listdir(root=True)
assert files_root
for obj in files_root:
assert not obj.user
assert obj.full_path == obj.path


@pytest.mark.parametrize("nc", NC_TO_TEST)
def test_list_user_root(nc):
user_root = nc.files.listdir()
Expand Down Expand Up @@ -191,6 +182,7 @@ def test_file_delete(nc):
@pytest.mark.parametrize("nc", NC_TO_TEST)
@pytest.mark.parametrize("dir_name", ("1 2", "Яё", "відео та картинки", "复杂 目录 Í", "Björn", "João"))
def test_mkdir(nc, dir_name):
nc.files.delete(dir_name, not_fail=True)
nc.files.mkdir(dir_name)
with pytest.raises(NextcloudException):
nc.files.mkdir(dir_name)
Expand Down

0 comments on commit 552d03e

Please sign in to comment.