34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
"""
|
|
Unit tests for page templates
|
|
"""
|
|
|
|
import pytest
|
|
from src.generation.page_templates import get_page_content
|
|
|
|
|
|
class TestGetPageContent:
|
|
"""Tests for page content generation"""
|
|
|
|
def test_about_page_heading(self):
|
|
content = get_page_content("about", "www.example.com")
|
|
assert content == "<h1>About Us</h1>"
|
|
|
|
def test_contact_page_heading(self):
|
|
content = get_page_content("contact", "www.example.com")
|
|
assert content == "<h1>Contact</h1>"
|
|
|
|
def test_privacy_page_heading(self):
|
|
content = get_page_content("privacy", "www.example.com")
|
|
assert content == "<h1>Privacy Policy</h1>"
|
|
|
|
def test_unknown_page_type_uses_titlecase(self):
|
|
content = get_page_content("terms", "www.example.com")
|
|
assert content == "<h1>Terms</h1>"
|
|
|
|
def test_returns_html_string(self):
|
|
content = get_page_content("about", "www.example.com")
|
|
assert isinstance(content, str)
|
|
assert content.startswith("<h1>")
|
|
assert content.endswith("</h1>")
|
|
|