aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/tests/conftest.py
blob: 03dfb42b36ff2bc331ec3203360b98f92b2ce055 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""Shared fixtures and helpers for node tests."""

from pathlib import Path

from meshbay_node.roots import RootSet


def one_root(path: Path, *, name: str = "", kind: str = "generic") -> RootSet:
    """
    A RootSet with a single root over `path`, receiving uploads.

    The equivalent of the old `shared_dir`. Note what it implies for assertions:
    a file directly in `path` now has `entry.path == <basename of path>`, not
    `""` — every index path carries its root name, in a group with one root as
    much as in a group with five.
    """
    return RootSet.build([{"path": str(path), "name": name, "kind": kind,
                           "upload": True}])