prole/tests/installer/test_config.py
chrisfu c0a7d0c5dc Refine installer orchestration and Supabase rendering paths
- improve installer/action/controller flow and shell-variable expansion handling across screens\n- adjust Supabase Helm rendering and storage deployment templates\n- align monitoring, cloudnative-pg and repair pipeline behavior with updated config paths\n- refresh and expand installer/core regression tests around milestones, navigation and repair logic

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-31 23:15:54 -07:00

41 lines
1.2 KiB
Python

from unittest.mock import patch, MagicMock
from knoe.config import (
normalize_version,
is_apple_silicon,
get_docker_build_platform_args,
)
def test_normalize_version():
assert normalize_version("1.2.3") == "01.02.03"
assert normalize_version("v1.2") == "01.02.00"
assert normalize_version("2") == "02.00.00"
assert normalize_version("10.0.1-beta") == "10.00.01"
assert normalize_version("") == ""
assert normalize_version("no numbers") == "no numbers"
@patch("platform.machine")
@patch("platform.system")
def test_is_apple_silicon(mock_system, mock_machine):
mock_machine.return_value = "arm64"
mock_system.return_value = "Darwin"
assert is_apple_silicon() is True
mock_machine.return_value = "x86_64"
assert is_apple_silicon() is False
mock_machine.return_value = "arm64"
mock_system.return_value = "Linux"
assert is_apple_silicon() is False
@patch("knoe.config.is_apple_silicon")
def test_get_docker_build_platform_args(mock_is_apple_silicon):
mock_is_apple_silicon.return_value = True
assert get_docker_build_platform_args() == ["--platform", "linux/amd64"]
mock_is_apple_silicon.return_value = False
assert get_docker_build_platform_args() == []