This commit is contained in:
2025-10-13 16:56:38 +02:00
parent bf636cbc66
commit 57b55b10a2
21 changed files with 624 additions and 202 deletions

View File

@@ -72,45 +72,41 @@ class TestVersionDetection:
assert isinstance(limits, dict), "get_version_limits() should return a dictionary"
# Check required keys
required_keys = ["max_texture_size", "max_concurrent_operations"]
required_keys = ["max_concurrent_operations"]
for key in required_keys:
assert key in limits, f"Missing required key '{key}' in version limits"
assert "max_texture_size" not in limits, "Texture size limit should not be enforced"
# Check value types
assert isinstance(limits["max_texture_size"], int), "max_texture_size should be an integer"
assert isinstance(limits["max_concurrent_operations"], int), "max_concurrent_operations should be an integer"
# Check version-specific limits
if VERSION_TYPE == "free":
assert limits["max_texture_size"] == 1024, f"Free version should have 1024px limit, got {limits['max_texture_size']}"
assert limits["max_concurrent_operations"] == 1, f"Free version should have 1 concurrent operation, got {limits['max_concurrent_operations']}"
else:
assert limits["max_texture_size"] == 4096, f"Full version should have 4096px limit, got {limits['max_texture_size']}"
assert limits["max_concurrent_operations"] == 4, f"Full version should have 4 concurrent operations, got {limits['max_concurrent_operations']}"
def test_get_version_limits_full_returns_pro_limits(self):
"""Verify full version returns correct limits for texture size and concurrent operations."""
"""Verify full version returns correct limits for concurrent operations."""
from src.utils.constants import get_version_limits
from unittest.mock import patch
with patch('src.utils.constants.VERSION_TYPE', 'full'):
limits = get_version_limits()
assert limits["max_texture_size"] == 4096, \
f"Expected full version max_texture_size=4096, got {limits['max_texture_size']}"
assert "max_texture_size" not in limits, "Full version should not enforce a texture size limit"
assert limits["max_concurrent_operations"] == 4, \
f"Expected full version max_concurrent_operations=4, got {limits['max_concurrent_operations']}"
def test_get_version_limits_free_returns_restricted_limits(self):
"""Verify free version returns restricted limits for texture size and concurrent operations."""
"""Verify free version returns restricted limits for concurrent operations only."""
from src.utils.constants import get_version_limits
from unittest.mock import patch
with patch('src.utils.constants.VERSION_TYPE', 'free'):
limits = get_version_limits()
assert limits["max_texture_size"] == 1024, \
f"Expected free version max_texture_size=1024, got {limits['max_texture_size']}"
assert "max_texture_size" not in limits, "Free version should not enforce a texture size limit"
assert limits["max_concurrent_operations"] == 1, \
f"Expected free version max_concurrent_operations=1, got {limits['max_concurrent_operations']}"
@@ -278,7 +274,7 @@ class TestVersionDifferentiationScenarios:
# Technical limitations
limits = get_version_limits()
assert limits["max_texture_size"] == 1024, "Should have 1024px texture limit"
assert "max_texture_size" not in limits, "Free version should not enforce a texture size cap"
assert limits["max_concurrent_operations"] == 1, "Should have 1 concurrent operation limit"
def test_full_version_complete_scenario(self):
@@ -296,5 +292,5 @@ class TestVersionDifferentiationScenarios:
# Generous technical limits
limits = get_version_limits()
assert limits["max_texture_size"] == 4096, "Should have 4096px texture limit"
assert "max_texture_size" not in limits, "Full version should not enforce a texture size cap"
assert limits["max_concurrent_operations"] == 4, "Should have 4 concurrent operations limit"