"""Tests for template_renderer module.""" from unittest.mock import MagicMock from babel.support import Translations from htmlmin.minify import html_minify import config from src.utils import template_renderer def test_render_template_valid(monkeypatch): """Test rendering a valid template.""" monkeypatch.setattr(Translations, 'load', MagicMock()) template_name = '__test__' context = {'first_name': 'John', 'last_name': 'Doe'} user_locale = 'en' result = template_renderer.render_template( template_name, context, user_locale) Translations.load.assert_called_once_with( config.I18N_FOLDER_NAME, [user_locale]) assert result == html_minify( 'I am the test template. My name is John Doe.')