def test_view(mount, context): root = Path(mount.backend.root) path = context.path (root / path / "childdir").mkdir(parents=True) with (root / path / "childfile").open("w") as f: pass request = DummyRequest() request.collator = DummyCollator() resp = directory_view(context, request) assert not resp["show_hidden"] assert resp["parents"] == [ (mount.name, "../../"), (path.parts[0], "../"), ] children = resp["children"] assert len(children) == 2 child = children[0] assert child.name == "childdir" assert isinstance(child, Directory) child = children[1] assert child.name == "childfile" assert isinstance(child, File)