Files
lix/tests/functional2/daemon/test_trust.py
T
eldritch horrors 36e784470c f2: turn Nix.daemon into a fixture
that way we can parametrize it over the list of protocols we have

Change-Id: Ie3fc267ade9c2ca74c163347f4fa58f09a317f40
2026-04-18 12:16:28 +00:00

22 lines
710 B
Python

import pytest
import json
from testlib.fixtures.nix import Nix, NixDaemon
@pytest.mark.parametrize(
("trusted", "flags", "expected"),
[
([], ["--default-trust"], False),
([], ["--force-trusted"], True),
(["*"], ["--default-trust"], True),
(["*"], ["--force-untrusted"], False),
],
)
def test_trust(nix: Nix, daemon: NixDaemon, trusted: list[str], flags: list[str], expected: bool):
nix.settings.add_xp_feature("nix-command", "daemon-trust-override")
with daemon(nix, flags, settings={"trusted-users": trusted}) as inner:
trusted = json.loads(inner.nix(["store", "ping", "--json"]).run().ok().stdout)
assert trusted["trusted"] == expected