prole/tests/installer/test_config.py
chrisfu 4ee2b259c9 Checkpoint: rename installer to knoe + harden db build context
- Add build-context helper to copy Docker context safely (ignore runtime data, keep symlinks)

- Update UI and core actions to use ~/.prole/build and shared copy helper

- Add/adjust tests and scripts; introduce knoe ops helpers and update manifests

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-22 01:45:21 -07:00

41 lines
1.2 KiB
Python

import pytest
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() == []