that way we can parametrize it over the list of protocols we have Change-Id: Ie3fc267ade9c2ca74c163347f4fa58f09a317f40
22 lines
710 B
Python
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
|