Merge pull request #842 from mishfit/refactorListAndWalk

Rename SiteStorage.list to SiteStorage.walk
This commit is contained in:
ZeroNet 2017-03-04 12:39:06 +01:00 committed by GitHub
commit 0e2f742b7e
5 changed files with 24 additions and 6 deletions

View file

@ -3,11 +3,20 @@ import pytest
@pytest.mark.usefixtures("resetSettings")
class TestSiteStorage:
def testWalk(self, site):
# Rootdir
walk_root = list(site.storage.walk(""))
assert "content.json" in walk_root
assert "css/all.css" in walk_root
# Subdir
assert list(site.storage.walk("data-default")) == ["data.json", "users/content-default.json"]
def testList(self, site):
# Rootdir
list_root = list(site.storage.list(""))
assert "content.json" in list_root
assert "css/all.css" in list_root
assert "css/all.css" not in list_root
# Subdir
assert list(site.storage.list("data-default")) == ["data.json", "users/content-default.json"]
assert list(site.storage.list("data-default")) == ["data.json", "users"]