mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 10:13:58 +00:00
- Refactored installer UI with updated canvas rendering, sidebar navigation, and footer buttons. - Enhanced styling for macOS compatibility and consistent design across controls. - Added Pytest-based unit tests for `screen.py` and `config.py`. - Expanded dependency catalog with new tools like `tshark` and `pyshark`. - Improved error tolerance for background rendering and added placeholders for Kerberos configuration.
34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
import pytest
|
|
from unittest.mock import patch, MagicMock
|
|
from installer.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("installer.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() == []
|