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
22 lines
679 B
Python
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
|