Skip to content

Commit 31eb20a

Browse files
authored
Update test_config.py
1 parent ebb4e32 commit 31eb20a

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

tests/test_config.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44

55
import pytest
66

7-
from ix_operator.config import OperatorConfig, OperatorMode, RuntimePaths, TransportBackend
7+
from ix_operator.config import (
8+
IMPLEMENTED_TRANSPORT_BACKENDS,
9+
OperatorConfig,
10+
OperatorMode,
11+
RuntimePaths,
12+
TransportBackend,
13+
)
814

915

1016
def test_runtime_paths_create_directories(tmp_path: Path) -> None:
@@ -30,12 +36,12 @@ def test_from_env_uses_defaults(monkeypatch: pytest.MonkeyPatch, tmp_path: Path)
3036
assert config.session_timeout_seconds == 10
3137

3238

33-
def test_from_env_parses_hardened_tor_settings(
39+
def test_from_env_parses_hardened_local_settings(
3440
monkeypatch: pytest.MonkeyPatch, tmp_path: Path
3541
) -> None:
3642
monkeypatch.setenv("IX_OPERATOR_RUNTIME_DIR", str(tmp_path / "runtime"))
3743
monkeypatch.setenv("IX_OPERATOR_MODE", "hardened")
38-
monkeypatch.setenv("IX_OPERATOR_TRANSPORT", "tor")
44+
monkeypatch.setenv("IX_OPERATOR_TRANSPORT", "local")
3945
monkeypatch.setenv("IX_OPERATOR_LOG_LEVEL", "warning")
4046
monkeypatch.setenv("IX_OPERATOR_TOR_SOCKS_PORT", "9150")
4147
monkeypatch.setenv("IX_OPERATOR_SESSION_TIMEOUT", "15")
@@ -44,22 +50,15 @@ def test_from_env_parses_hardened_tor_settings(
4450
config = OperatorConfig.from_env()
4551

4652
assert config.mode == OperatorMode.HARDENED
47-
assert config.transport_backend == TransportBackend.TOR
53+
assert config.transport_backend == TransportBackend.LOCAL
4854
assert config.log_level == "warning"
4955
assert config.tor_socks_port == 9150
5056
assert config.session_timeout_seconds == 15
5157
assert config.packet_size_bytes == 2048
5258

5359

54-
def test_hardened_mode_rejects_local_transport(
55-
monkeypatch: pytest.MonkeyPatch, tmp_path: Path
56-
) -> None:
57-
monkeypatch.setenv("IX_OPERATOR_RUNTIME_DIR", str(tmp_path / "runtime"))
58-
monkeypatch.setenv("IX_OPERATOR_MODE", "hardened")
59-
monkeypatch.setenv("IX_OPERATOR_TRANSPORT", "local")
60-
61-
with pytest.raises(ValueError, match="hardened mode cannot use the local transport"):
62-
OperatorConfig.from_env()
60+
def test_implemented_transport_backends_only_include_local() -> None:
61+
assert IMPLEMENTED_TRANSPORT_BACKENDS == (TransportBackend.LOCAL,)
6362

6463

6564
def test_invalid_integer_env_raises(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:

0 commit comments

Comments
 (0)