Files
lix/tests/functional2/daemon/test_trust.py
T
rootile f761785099 tests/functional2/nix: refactor NixSettings
This is the long awaited refactor of the NixSettings.
It allows one to set, unset and update any and all settings with a neat
and easy-to-use interface

closes #846

Change-Id: Id4cfb5f853cc1168b506a1f6f405076f3a7cab65
2026-02-09 15:37:40 +01:00

22 lines
679 B
Python

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