Systematic rename of all semantic anchors (#region, [DEF], @RELATION) across 1400+ files — backend Python, frontend Svelte/TS, specs, docs: - Flat anchors become Namespace.Module.Entity - @RELATION references updated to match new anchor paths - Zero business logic changes
71 lines
3.4 KiB
Python
71 lines
3.4 KiB
Python
# #region Test.StorageAuditFixes.TestStorageAuditFixes [C:3] [TYPE Module] [SEMANTICS test,storage,typo,audit]
|
|
# @BRIEF Verify Class 7 typo fix — "repositorys" → "repositories" across all storage/git modules.
|
|
# @RELATION BINDS_TO -> [Models.Storage.StorageModels]
|
|
# @RELATION BINDS_TO -> [Services.Base.GitServiceBase]
|
|
# @TEST_EDGE: typo_regression -> FileCategory.REPOSITORY == "repositories" (not "repositorys")
|
|
# @TEST_EDGE: default_path -> StorageConfig().repo_path defaults to "repositories"
|
|
# @TEST_EDGE: git_typo_regression -> No "repositorys" string exists in storage/git source files
|
|
from pathlib import Path
|
|
import sys
|
|
|
|
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
|
|
|
|
|
|
class TestStorageAuditFixes:
|
|
"""Verify the "repositorys" → "repositories" typo fix."""
|
|
|
|
# #region Test.StorageAuditFixes.TestRepositoryTypoFixed [C:2] [TYPE Function]
|
|
# @BRIEF FileCategory.REPOSITORY equals "repositories", NOT "repositorys".
|
|
def test_repository_typo_fixed(self):
|
|
from src.models.storage import FileCategory
|
|
assert FileCategory.REPOSITORY == "repositories"
|
|
assert FileCategory.REPOSITORY.value == "repositories"
|
|
# #endregion Test.StorageAuditFixes.TestRepositoryTypoFixed
|
|
|
|
# #region Test.StorageAuditFixes.TestRepoPathDefaultFixed [C:2] [TYPE Function]
|
|
# @BRIEF StorageConfig().repo_path defaults to "repositories".
|
|
def test_repo_path_default_fixed(self):
|
|
from src.models.storage import StorageConfig
|
|
config = StorageConfig()
|
|
assert config.repo_path == "repositories"
|
|
# #endregion Test.StorageAuditFixes.TestRepoPathDefaultFixed
|
|
|
|
# #region Test.StorageAuditFixes.TestStorageModelCompiles [C:2] [TYPE Function]
|
|
# @BRIEF All storage model classes import without errors.
|
|
def test_storage_model_compiles(self):
|
|
# Verify instantiation of StoredFile with all required fields
|
|
from datetime import datetime
|
|
|
|
from src.models.storage import FileCategory, StoredFile
|
|
f = StoredFile(
|
|
name="test.txt",
|
|
path="backups/test.txt",
|
|
size=42,
|
|
created_at=datetime.now(),
|
|
category=FileCategory.BACKUP,
|
|
)
|
|
assert f.name == "test.txt"
|
|
assert f.size == 42
|
|
assert f.category == FileCategory.BACKUP
|
|
# #endregion Test.StorageAuditFixes.TestStorageModelCompiles
|
|
|
|
# #region Test.StorageAuditFixes.TestBackupCategoryUnchanged [C:2] [TYPE Function]
|
|
# @BRIEF FileCategory.BACKUP still equals "backups" (not affected by typo fix).
|
|
def test_backup_category_unchanged(self):
|
|
from src.models.storage import FileCategory
|
|
assert FileCategory.BACKUP == "backups"
|
|
# #endregion Test.StorageAuditFixes.TestBackupCategoryUnchanged
|
|
|
|
# #region Test.StorageAuditFixes.TestStorageConfigFieldsHaveCorrectTypes [C:2] [TYPE Function]
|
|
# @BRIEF StorageConfig fields are all strings with correct defaults.
|
|
def test_storage_config_fields_have_correct_types(self):
|
|
from src.models.storage import StorageConfig
|
|
config = StorageConfig()
|
|
assert isinstance(config.root_path, str)
|
|
assert isinstance(config.backup_path, str)
|
|
assert isinstance(config.repo_path, str)
|
|
assert config.root_path == "/app/storage"
|
|
assert config.backup_path == "backups"
|
|
# #endregion Test.StorageAuditFixes.TestStorageConfigFieldsHaveCorrectTypes
|
|
# #endregion Test.StorageAuditFixes.TestStorageAuditFixes
|