Files
Aniworld/tests/unit/test_templates_utils.py
Lukas 5b3fbf36b9 Task 4: Add Services & Utilities tests (66 tests)
- test_media_utils.py: 29 tests for check_media_files, get_media_file_paths,
  has_all_images, count_video_files, has_video_files, constants
- test_nfo_factory.py: 11 tests for NFOServiceFactory.create, create_optional,
  get_nfo_factory singleton, create_nfo_service convenience
- test_series_manager_service.py: 15 tests for init, from_settings,
  process_nfo_for_series, scan_and_process_nfo, close
- test_templates_utils.py: 4 tests for TEMPLATES_DIR path resolution
- test_error_controller.py: 7 tests for 404/500 handlers (API vs HTML)
2026-02-15 17:49:11 +01:00

31 lines
943 B
Python

"""Unit tests for template utilities and configuration.
Tests the templates module constants and the TEMPLATES_DIR path resolution.
"""
from pathlib import Path
import pytest
from src.server.utils.templates import TEMPLATES_DIR
class TestTemplatesConfig:
"""Tests for templates module configuration."""
def test_templates_dir_is_path(self):
"""TEMPLATES_DIR is a Path object."""
assert isinstance(TEMPLATES_DIR, Path)
def test_templates_dir_ends_with_templates(self):
"""TEMPLATES_DIR path ends with 'templates'."""
assert TEMPLATES_DIR.name == "templates"
def test_templates_dir_parent_is_web(self):
"""TEMPLATES_DIR parent is 'web' directory."""
assert TEMPLATES_DIR.parent.name == "web"
def test_templates_dir_grandparent_is_server(self):
"""TEMPLATES_DIR grandparent is 'server' directory."""
assert TEMPLATES_DIR.parent.parent.name == "server"