mirror of
https://github.com/kennethreitz/kjvstudy.org.git
synced 2026-06-05 23:00:16 +00:00
Add comprehensive ARIA labels and resource route tests
Accessibility Improvements: - Add ARIA roles and labels to search.html (search form, results, status messages) - Add ARIA landmarks to resource_detail.html (article, sections, navigation) - Add ARIA landmarks to resource_index.html (TOC, sections, verse lists) - Add aria-hidden to decorative SVG icons throughout templates - Implement aria-labelledby for sectioning elements - Add role="list" and role="listitem" for verse lists Test Coverage: - Create comprehensive test_resource_routes.py with 76 new tests - Test 26+ resource index pages (angels, prophets, parables, etc.) - Test systematic theology routes (trinity, christology, soteriology, etc.) - Test special topic routes (messianic prophecies, types/shadows, etc.) - Test doctrinal routes (grace, justification, sanctification, etc.) - Test detail pages and 404 handling for invalid slugs - Test HTML structure and content types All 252 tests passing (up from 176). Improved WCAG 2.1 compliance. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -109,6 +109,7 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<article role="article">
|
||||
{% if category_name %}
|
||||
<div class="resource-category">{{ category_name }}</div>
|
||||
{% endif %}
|
||||
@@ -117,8 +118,8 @@
|
||||
|
||||
{% if pdf_available and pdf_url %}
|
||||
<div class="resource-actions">
|
||||
<a href="{{ pdf_url }}" class="print-btn">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<a href="{{ pdf_url }}" class="print-btn" aria-label="Download {{ item_name }} as PDF">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
||||
</svg>
|
||||
Download PDF
|
||||
@@ -126,23 +127,23 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<section>
|
||||
<h2>Description</h2>
|
||||
<section aria-labelledby="description-heading">
|
||||
<h2 id="description-heading">Description</h2>
|
||||
<div class="resource-description">
|
||||
{{ item.description | link_names | link_verses | safe }}
|
||||
</div>
|
||||
{% if item.family_tree_link %}
|
||||
<p style="margin-top: 1.5rem;">
|
||||
<a href="{{ item.family_tree_link }}">View {{ item_name }} in Family Tree →</a>
|
||||
<a href="{{ item.family_tree_link }}" aria-label="View {{ item_name }} in the Family Tree">View {{ item_name }} in Family Tree →</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Key Verses</h2>
|
||||
<div class="verse-list">
|
||||
<section aria-labelledby="verses-heading">
|
||||
<h2 id="verses-heading">Key Verses</h2>
|
||||
<div class="verse-list" role="list">
|
||||
{% for verse in item.verses %}
|
||||
<div class="verse-item">
|
||||
<div class="verse-item" role="listitem">
|
||||
<div class="verse-ref">
|
||||
{% set ref_parts = verse.reference.rsplit(' ', 1) %}
|
||||
{% if ref_parts|length == 2 %}
|
||||
@@ -151,7 +152,7 @@
|
||||
{% if ':' in chapter_verse %}
|
||||
{% set ch = chapter_verse.split(':')[0] %}
|
||||
{% set v = chapter_verse.split(':')[1] %}
|
||||
<a href="/book/{{ book_name }}/chapter/{{ ch }}/verse/{{ v }}">{{ verse.reference }}</a>
|
||||
<a href="/book/{{ book_name }}/chapter/{{ ch }}/verse/{{ v }}" aria-label="{{ verse.reference }}">{{ verse.reference }}</a>
|
||||
{% else %}
|
||||
{{ verse.reference }}
|
||||
{% endif %}
|
||||
@@ -164,7 +165,8 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<p><a href="{{ back_url }}">← Back to {{ back_text }}</a></p>
|
||||
</section>
|
||||
<nav aria-label="Resource navigation">
|
||||
<p><a href="{{ back_url }}" aria-label="Back to {{ back_text }}">← Back to {{ back_text }}</a></p>
|
||||
</nav>
|
||||
</article>
|
||||
{% endblock %}
|
||||
|
||||
@@ -178,8 +178,8 @@
|
||||
|
||||
{% if pdf_available %}
|
||||
<div class="resource-index-actions">
|
||||
<a class="resource-download-btn" href="{{ base_url }}/pdf">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<a class="resource-download-btn" href="{{ base_url }}/pdf" aria-label="Download all {{ page_title }} as PDF">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
||||
</svg>
|
||||
Download All (PDF)
|
||||
@@ -188,18 +188,18 @@
|
||||
{% endif %}
|
||||
|
||||
{% if page_description %}
|
||||
<section>
|
||||
<section aria-label="Introduction">
|
||||
<p class="intro-text">{{ page_description | mdi | link_names | link_verses | safe }}</p>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
<nav class="toc" id="toc">
|
||||
<nav class="toc" id="toc" aria-label="Table of contents">
|
||||
<h2>Contents</h2>
|
||||
<ul id="toc-list"></ul>
|
||||
</nav>
|
||||
|
||||
{% if intro_sidenotes %}
|
||||
<section>
|
||||
<section aria-label="Additional notes">
|
||||
{% for intro in intro_sidenotes %}
|
||||
<p class="intro-text">{{ intro.text | mdi | link_names | link_verses | safe }}</p>
|
||||
{% endfor %}
|
||||
@@ -207,12 +207,12 @@
|
||||
{% endif %}
|
||||
|
||||
{% for category, items in resource_data.items() %}
|
||||
<section class="resource-section">
|
||||
<h2>{{ category }}</h2>
|
||||
<section class="resource-section" aria-labelledby="section-{{ category|slugify }}">
|
||||
<h2 id="section-{{ category|slugify }}">{{ category }}</h2>
|
||||
|
||||
{% for item_name, item in items.items() %}
|
||||
<article class="resource-entry">
|
||||
<h3 class="resource-name"><a href="{{ base_url }}/{{ item_name|slugify }}">{{ item_name }}</a></h3>
|
||||
<article class="resource-entry" aria-labelledby="resource-{{ item_name|slugify }}">
|
||||
<h3 class="resource-name" id="resource-{{ item_name|slugify }}"><a href="{{ base_url }}/{{ item_name|slugify }}">{{ item_name }}</a></h3>
|
||||
<p class="resource-item-title">{{ item.title }}</p>
|
||||
|
||||
<div class="resource-item-description">
|
||||
@@ -220,9 +220,9 @@
|
||||
</div>
|
||||
|
||||
{% if item.verses %}
|
||||
<div class="verse-list">
|
||||
<div class="verse-list" role="list" aria-label="Key verses for {{ item_name }}">
|
||||
{% for verse in item.verses %}
|
||||
<div class="verse-item">
|
||||
<div class="verse-item" role="listitem">
|
||||
<div class="verse-ref">
|
||||
{% set ref_parts = verse.reference.rsplit(' ', 1) %}
|
||||
{% if ref_parts|length == 2 %}
|
||||
@@ -231,7 +231,7 @@
|
||||
{% if ':' in chapter_verse %}
|
||||
{% set ch = chapter_verse.split(':')[0] %}
|
||||
{% set v = chapter_verse.split(':')[1].split('-')[0] %}
|
||||
<a href="/book/{{ book_name }}/chapter/{{ ch }}/verse/{{ v }}">{{ verse.reference }}</a>
|
||||
<a href="/book/{{ book_name }}/chapter/{{ ch }}/verse/{{ v }}" aria-label="{{ verse.reference }}">{{ verse.reference }}</a>
|
||||
{% else %}
|
||||
{{ verse.reference }}
|
||||
{% endif %}
|
||||
|
||||
@@ -163,8 +163,8 @@
|
||||
<h1>Search the KJV Bible</h1>
|
||||
<p class="subtitle">Search across all verses in the Authorized King James Version</p>
|
||||
|
||||
<section>
|
||||
<form class="search-form" method="get" action="/search">
|
||||
<section role="search" aria-label="Bible search">
|
||||
<form class="search-form" method="get" action="/search" role="search">
|
||||
<div class="search-input-wrapper">
|
||||
<input
|
||||
type="text"
|
||||
@@ -178,20 +178,21 @@
|
||||
autocapitalize="off"
|
||||
spellcheck="false"
|
||||
autofocus
|
||||
aria-label="Search for Bible verses, topics, and resources"
|
||||
>
|
||||
<div id="search-dropdown" class="search-dropdown"></div>
|
||||
<div id="search-dropdown" class="search-dropdown" role="listbox" aria-live="polite"></div>
|
||||
</div>
|
||||
<button type="submit" class="search-button">Search</button>
|
||||
<button type="submit" class="search-button" aria-label="Submit search query">Search</button>
|
||||
</form>
|
||||
|
||||
{% if query %}
|
||||
{% if total_results > 0 %}
|
||||
<div class="search-stats">
|
||||
<div class="search-stats" role="status" aria-live="polite">
|
||||
Found <strong>{{ total_results }}</strong> result{{ 's' if total_results != 1 else '' }} for "<strong>{{ query }}</strong>"
|
||||
</div>
|
||||
|
||||
{% if family_tree_results %}
|
||||
<h2 style="margin-top: 2rem;">People in Family Tree</h2>
|
||||
<h2 style="margin-top: 2rem;" role="heading" aria-level="2">People in Family Tree</h2>
|
||||
{% for result in family_tree_results %}
|
||||
<article class="search-result">
|
||||
<div class="result-reference">
|
||||
|
||||
@@ -0,0 +1,622 @@
|
||||
"""
|
||||
Tests for biblical resource routes.
|
||||
|
||||
These tests cover 30+ resource endpoints including angels, prophets, parables,
|
||||
systematic theology topics, and more.
|
||||
"""
|
||||
import pytest
|
||||
|
||||
|
||||
class TestBiblicalAngelsRoutes:
|
||||
"""Tests for biblical angels resource routes"""
|
||||
|
||||
def test_angels_index_loads(self, client):
|
||||
"""Test biblical angels index page loads"""
|
||||
response = client.get("/biblical-angels")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "angel" in content.lower()
|
||||
|
||||
def test_angels_index_has_content(self, client):
|
||||
"""Test angels index has substantial content"""
|
||||
response = client.get("/biblical-angels")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert len(content) > 1000
|
||||
|
||||
def test_angels_detail_page(self, client):
|
||||
"""Test individual angel detail page"""
|
||||
response = client.get("/biblical-angels/gabriel")
|
||||
assert response.status_code in [200, 404]
|
||||
|
||||
if response.status_code == 200:
|
||||
content = response.content.decode()
|
||||
assert "gabriel" in content.lower()
|
||||
|
||||
def test_angels_invalid_slug(self, client):
|
||||
"""Test non-existent angel returns 404"""
|
||||
response = client.get("/biblical-angels/invalid-angel-xyz")
|
||||
assert response.status_code == 404
|
||||
|
||||
def test_angels_pdf_generation(self, client):
|
||||
"""Test angels index PDF generation"""
|
||||
response = client.get("/biblical-angels/pdf")
|
||||
assert response.status_code in [200, 500, 503]
|
||||
|
||||
if response.status_code == 200:
|
||||
assert response.headers["content-type"] == "application/pdf"
|
||||
|
||||
|
||||
class TestBiblicalProphetsRoutes:
|
||||
"""Tests for biblical prophets resource routes"""
|
||||
|
||||
def test_prophets_index_loads(self, client):
|
||||
"""Test biblical prophets index page loads"""
|
||||
response = client.get("/biblical-prophets")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "prophet" in content.lower()
|
||||
|
||||
def test_prophets_index_has_content(self, client):
|
||||
"""Test prophets index has substantial content"""
|
||||
response = client.get("/biblical-prophets")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert len(content) > 1000
|
||||
|
||||
def test_prophets_detail_page(self, client):
|
||||
"""Test individual prophet detail page"""
|
||||
response = client.get("/biblical-prophets/isaiah")
|
||||
assert response.status_code in [200, 404]
|
||||
|
||||
if response.status_code == 200:
|
||||
content = response.content.decode()
|
||||
assert "isaiah" in content.lower()
|
||||
|
||||
def test_prophets_invalid_slug(self, client):
|
||||
"""Test non-existent prophet returns 404"""
|
||||
response = client.get("/biblical-prophets/invalid-prophet-xyz")
|
||||
assert response.status_code == 404
|
||||
|
||||
|
||||
class TestNamesOfGodRoutes:
|
||||
"""Tests for Names of God resource routes"""
|
||||
|
||||
def test_names_of_god_index_loads(self, client):
|
||||
"""Test Names of God index page loads"""
|
||||
response = client.get("/names-of-god")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "name" in content.lower() or "god" in content.lower()
|
||||
|
||||
def test_names_of_god_detail_page(self, client):
|
||||
"""Test individual name detail page"""
|
||||
response = client.get("/names-of-god/yahweh")
|
||||
assert response.status_code in [200, 404]
|
||||
|
||||
def test_names_of_god_invalid_slug(self, client):
|
||||
"""Test non-existent name returns 404"""
|
||||
response = client.get("/names-of-god/invalid-name-xyz")
|
||||
assert response.status_code == 404
|
||||
|
||||
|
||||
class TestParablesRoutes:
|
||||
"""Tests for parables resource routes"""
|
||||
|
||||
def test_parables_index_loads(self, client):
|
||||
"""Test parables index page loads"""
|
||||
response = client.get("/parables")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "parable" in content.lower()
|
||||
|
||||
def test_parables_detail_page(self, client):
|
||||
"""Test individual parable detail page"""
|
||||
response = client.get("/parables/good-samaritan")
|
||||
assert response.status_code in [200, 404]
|
||||
|
||||
def test_parables_invalid_slug(self, client):
|
||||
"""Test non-existent parable returns 404"""
|
||||
response = client.get("/parables/invalid-parable-xyz")
|
||||
assert response.status_code == 404
|
||||
|
||||
|
||||
class TestBiblicalCovenantsRoutes:
|
||||
"""Tests for biblical covenants resource routes"""
|
||||
|
||||
def test_covenants_index_loads(self, client):
|
||||
"""Test biblical covenants index page loads"""
|
||||
response = client.get("/biblical-covenants")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "covenant" in content.lower()
|
||||
|
||||
def test_covenants_detail_page(self, client):
|
||||
"""Test individual covenant detail page"""
|
||||
response = client.get("/biblical-covenants/abrahamic")
|
||||
assert response.status_code in [200, 404]
|
||||
|
||||
def test_covenants_invalid_slug(self, client):
|
||||
"""Test non-existent covenant returns 404"""
|
||||
response = client.get("/biblical-covenants/invalid-covenant-xyz")
|
||||
assert response.status_code == 404
|
||||
|
||||
|
||||
class TestTwelveApostlesRoutes:
|
||||
"""Tests for the twelve apostles resource routes"""
|
||||
|
||||
def test_apostles_index_loads(self, client):
|
||||
"""Test twelve apostles index page loads"""
|
||||
response = client.get("/the-twelve-apostles")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "apostle" in content.lower()
|
||||
|
||||
def test_apostles_detail_page(self, client):
|
||||
"""Test individual apostle detail page"""
|
||||
response = client.get("/the-twelve-apostles/peter")
|
||||
assert response.status_code in [200, 404]
|
||||
|
||||
def test_apostles_invalid_slug(self, client):
|
||||
"""Test non-existent apostle returns 404"""
|
||||
response = client.get("/the-twelve-apostles/invalid-apostle-xyz")
|
||||
assert response.status_code == 404
|
||||
|
||||
|
||||
class TestWomenOfTheBibleRoutes:
|
||||
"""Tests for women of the Bible resource routes"""
|
||||
|
||||
def test_women_index_loads(self, client):
|
||||
"""Test women of the Bible index page loads"""
|
||||
response = client.get("/women-of-the-bible")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "women" in content.lower() or "woman" in content.lower()
|
||||
|
||||
def test_women_detail_page(self, client):
|
||||
"""Test individual woman detail page"""
|
||||
response = client.get("/women-of-the-bible/mary")
|
||||
assert response.status_code in [200, 404]
|
||||
|
||||
def test_women_invalid_slug(self, client):
|
||||
"""Test non-existent woman returns 404"""
|
||||
response = client.get("/women-of-the-bible/invalid-woman-xyz")
|
||||
assert response.status_code == 404
|
||||
|
||||
|
||||
class TestBiblicalFestivalsRoutes:
|
||||
"""Tests for biblical festivals resource routes"""
|
||||
|
||||
def test_festivals_index_loads(self, client):
|
||||
"""Test biblical festivals index page loads"""
|
||||
response = client.get("/biblical-festivals")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "festival" in content.lower() or "feast" in content.lower()
|
||||
|
||||
def test_festivals_detail_page(self, client):
|
||||
"""Test individual festival detail page"""
|
||||
response = client.get("/biblical-festivals/passover")
|
||||
assert response.status_code in [200, 404]
|
||||
|
||||
def test_festivals_invalid_slug(self, client):
|
||||
"""Test non-existent festival returns 404"""
|
||||
response = client.get("/biblical-festivals/invalid-festival-xyz")
|
||||
assert response.status_code == 404
|
||||
|
||||
|
||||
class TestFruitsOfTheSpiritRoutes:
|
||||
"""Tests for fruits of the Spirit resource routes"""
|
||||
|
||||
def test_fruits_index_loads(self, client):
|
||||
"""Test fruits of the Spirit index page loads"""
|
||||
response = client.get("/fruits-of-the-spirit")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "fruit" in content.lower() or "spirit" in content.lower()
|
||||
|
||||
def test_fruits_detail_page(self, client):
|
||||
"""Test individual fruit detail page"""
|
||||
response = client.get("/fruits-of-the-spirit/love")
|
||||
assert response.status_code in [200, 404]
|
||||
|
||||
def test_fruits_invalid_slug(self, client):
|
||||
"""Test non-existent fruit returns 404"""
|
||||
response = client.get("/fruits-of-the-spirit/invalid-fruit-xyz")
|
||||
assert response.status_code == 404
|
||||
|
||||
|
||||
class TestMiraclesOfJesusRoutes:
|
||||
"""Tests for miracles of Jesus resource routes"""
|
||||
|
||||
def test_miracles_index_loads(self, client):
|
||||
"""Test miracles of Jesus index page loads"""
|
||||
response = client.get("/miracles-of-jesus")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "miracle" in content.lower()
|
||||
|
||||
def test_miracles_detail_page(self, client):
|
||||
"""Test individual miracle detail page"""
|
||||
response = client.get("/miracles-of-jesus/feeding-5000")
|
||||
assert response.status_code in [200, 404]
|
||||
|
||||
def test_miracles_invalid_slug(self, client):
|
||||
"""Test non-existent miracle returns 404"""
|
||||
response = client.get("/miracles-of-jesus/invalid-miracle-xyz")
|
||||
assert response.status_code == 404
|
||||
|
||||
|
||||
class TestPrayersOfTheBibleRoutes:
|
||||
"""Tests for prayers of the Bible resource routes"""
|
||||
|
||||
def test_prayers_index_loads(self, client):
|
||||
"""Test prayers of the Bible index page loads"""
|
||||
response = client.get("/prayers-of-the-bible")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "prayer" in content.lower()
|
||||
|
||||
def test_prayers_detail_page(self, client):
|
||||
"""Test individual prayer detail page"""
|
||||
response = client.get("/prayers-of-the-bible/lords-prayer")
|
||||
assert response.status_code in [200, 404]
|
||||
|
||||
def test_prayers_invalid_slug(self, client):
|
||||
"""Test non-existent prayer returns 404"""
|
||||
response = client.get("/prayers-of-the-bible/invalid-prayer-xyz")
|
||||
assert response.status_code == 404
|
||||
|
||||
|
||||
class TestBeatitudesRoutes:
|
||||
"""Tests for Beatitudes resource routes"""
|
||||
|
||||
def test_beatitudes_index_loads(self, client):
|
||||
"""Test Beatitudes index page loads"""
|
||||
response = client.get("/beatitudes")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "beatitude" in content.lower() or "blessed" in content.lower()
|
||||
|
||||
def test_beatitudes_detail_page(self, client):
|
||||
"""Test individual beatitude detail page"""
|
||||
response = client.get("/beatitudes/poor-in-spirit")
|
||||
assert response.status_code in [200, 404]
|
||||
|
||||
def test_beatitudes_invalid_slug(self, client):
|
||||
"""Test non-existent beatitude returns 404"""
|
||||
response = client.get("/beatitudes/invalid-beatitude-xyz")
|
||||
assert response.status_code == 404
|
||||
|
||||
|
||||
class TestTenCommandmentsRoutes:
|
||||
"""Tests for Ten Commandments resource routes"""
|
||||
|
||||
def test_commandments_index_loads(self, client):
|
||||
"""Test Ten Commandments index page loads"""
|
||||
response = client.get("/ten-commandments")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "commandment" in content.lower()
|
||||
|
||||
def test_commandments_detail_page(self, client):
|
||||
"""Test individual commandment detail page"""
|
||||
response = client.get("/ten-commandments/no-other-gods")
|
||||
assert response.status_code in [200, 404]
|
||||
|
||||
def test_commandments_invalid_slug(self, client):
|
||||
"""Test non-existent commandment returns 404"""
|
||||
response = client.get("/ten-commandments/invalid-commandment-xyz")
|
||||
assert response.status_code == 404
|
||||
|
||||
|
||||
class TestArmorOfGodRoutes:
|
||||
"""Tests for Armor of God resource routes"""
|
||||
|
||||
def test_armor_index_loads(self, client):
|
||||
"""Test Armor of God index page loads"""
|
||||
response = client.get("/armor-of-god")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "armor" in content.lower()
|
||||
|
||||
def test_armor_detail_page(self, client):
|
||||
"""Test individual armor piece detail page"""
|
||||
response = client.get("/armor-of-god/breastplate-of-righteousness")
|
||||
assert response.status_code in [200, 404]
|
||||
|
||||
def test_armor_invalid_slug(self, client):
|
||||
"""Test non-existent armor piece returns 404"""
|
||||
response = client.get("/armor-of-god/invalid-armor-xyz")
|
||||
assert response.status_code == 404
|
||||
|
||||
|
||||
class TestIAmStatementsRoutes:
|
||||
"""Tests for I Am statements resource routes"""
|
||||
|
||||
def test_i_am_index_loads(self, client):
|
||||
"""Test I Am statements index page loads"""
|
||||
response = client.get("/i-am-statements")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "i am" in content.lower()
|
||||
|
||||
def test_i_am_detail_page(self, client):
|
||||
"""Test individual I Am statement detail page"""
|
||||
response = client.get("/i-am-statements/bread-of-life")
|
||||
assert response.status_code in [200, 404]
|
||||
|
||||
def test_i_am_invalid_slug(self, client):
|
||||
"""Test non-existent I Am statement returns 404"""
|
||||
response = client.get("/i-am-statements/invalid-statement-xyz")
|
||||
assert response.status_code == 404
|
||||
|
||||
|
||||
class TestSystematicTheologyRoutes:
|
||||
"""Tests for systematic theology resource routes"""
|
||||
|
||||
def test_trinity_index_loads(self, client):
|
||||
"""Test Trinity index page loads"""
|
||||
response = client.get("/trinity")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "trinity" in content.lower()
|
||||
|
||||
def test_christology_index_loads(self, client):
|
||||
"""Test Christology index page loads"""
|
||||
response = client.get("/christology")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "christ" in content.lower() or "christology" in content.lower()
|
||||
|
||||
def test_soteriology_index_loads(self, client):
|
||||
"""Test Soteriology (salvation) index page loads"""
|
||||
response = client.get("/soteriology")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "salvation" in content.lower() or "soteriology" in content.lower()
|
||||
|
||||
def test_pneumatology_index_loads(self, client):
|
||||
"""Test Pneumatology (Holy Spirit) index page loads"""
|
||||
response = client.get("/pneumatology")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "spirit" in content.lower() or "pneumatology" in content.lower()
|
||||
|
||||
def test_eschatology_index_loads(self, client):
|
||||
"""Test Eschatology (end times) index page loads"""
|
||||
response = client.get("/eschatology")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "eschatology" in content.lower() or "end" in content.lower()
|
||||
|
||||
def test_ecclesiology_index_loads(self, client):
|
||||
"""Test Ecclesiology (church) index page loads"""
|
||||
response = client.get("/ecclesiology")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "church" in content.lower() or "ecclesiology" in content.lower()
|
||||
|
||||
def test_theology_proper_index_loads(self, client):
|
||||
"""Test Theology Proper (study of God) index page loads"""
|
||||
response = client.get("/theology-proper")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "god" in content.lower() or "theology" in content.lower()
|
||||
|
||||
def test_bibliology_index_loads(self, client):
|
||||
"""Test Bibliology (study of Scripture) index page loads"""
|
||||
response = client.get("/bibliology")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "bible" in content.lower() or "scripture" in content.lower()
|
||||
|
||||
def test_anthropology_index_loads(self, client):
|
||||
"""Test Anthropology (study of humanity) index page loads"""
|
||||
response = client.get("/anthropology")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "man" in content.lower() or "anthropology" in content.lower() or "human" in content.lower()
|
||||
|
||||
def test_hamartiology_index_loads(self, client):
|
||||
"""Test Hamartiology (study of sin) index page loads"""
|
||||
response = client.get("/hamartiology")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "sin" in content.lower() or "hamartiology" in content.lower()
|
||||
|
||||
|
||||
class TestSpecialTopicRoutes:
|
||||
"""Tests for special topic resource routes"""
|
||||
|
||||
def test_tetragrammaton_page_loads(self, client):
|
||||
"""Test Tetragrammaton (YHWH) page loads"""
|
||||
response = client.get("/tetragrammaton")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "yhwh" in content.lower() or "tetragrammaton" in content.lower()
|
||||
|
||||
def test_types_and_shadows_index_loads(self, client):
|
||||
"""Test Types and Shadows index page loads"""
|
||||
response = client.get("/types-and-shadows")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "type" in content.lower() or "shadow" in content.lower()
|
||||
|
||||
def test_messianic_prophecies_index_loads(self, client):
|
||||
"""Test Messianic Prophecies index page loads"""
|
||||
response = client.get("/messianic-prophecies")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "messiah" in content.lower() or "prophecy" in content.lower() or "prophecies" in content.lower()
|
||||
|
||||
def test_blood_in_scripture_index_loads(self, client):
|
||||
"""Test Blood in Scripture index page loads"""
|
||||
response = client.get("/blood-in-scripture")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "blood" in content.lower()
|
||||
|
||||
def test_kingdom_of_god_index_loads(self, client):
|
||||
"""Test Kingdom of God index page loads"""
|
||||
response = client.get("/kingdom-of-god")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "kingdom" in content.lower()
|
||||
|
||||
def test_names_of_christ_index_loads(self, client):
|
||||
"""Test Names of Christ index page loads"""
|
||||
response = client.get("/names-of-christ")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "christ" in content.lower() or "name" in content.lower()
|
||||
|
||||
def test_spirits_and_demons_index_loads(self, client):
|
||||
"""Test Spirits and Demons index page loads"""
|
||||
response = client.get("/spirits-and-demons")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "spirit" in content.lower() or "demon" in content.lower()
|
||||
|
||||
def test_personifications_index_loads(self, client):
|
||||
"""Test Personifications index page loads"""
|
||||
response = client.get("/personifications")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "personification" in content.lower()
|
||||
|
||||
|
||||
class TestDoctrinalTopicRoutes:
|
||||
"""Tests for doctrinal topic resource routes"""
|
||||
|
||||
def test_providence_index_loads(self, client):
|
||||
"""Test Providence index page loads"""
|
||||
response = client.get("/providence")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "providence" in content.lower()
|
||||
|
||||
def test_grace_index_loads(self, client):
|
||||
"""Test Grace index page loads"""
|
||||
response = client.get("/grace")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "grace" in content.lower()
|
||||
|
||||
def test_justification_index_loads(self, client):
|
||||
"""Test Justification index page loads"""
|
||||
response = client.get("/justification")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "justif" in content.lower()
|
||||
|
||||
def test_sanctification_index_loads(self, client):
|
||||
"""Test Sanctification index page loads"""
|
||||
response = client.get("/sanctification")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "sanctif" in content.lower()
|
||||
|
||||
def test_law_and_gospel_index_loads(self, client):
|
||||
"""Test Law and Gospel index page loads"""
|
||||
response = client.get("/law-and-gospel")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "law" in content.lower() or "gospel" in content.lower()
|
||||
|
||||
def test_worship_index_loads(self, client):
|
||||
"""Test Worship index page loads"""
|
||||
response = client.get("/worship")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "worship" in content.lower()
|
||||
|
||||
|
||||
class TestResourceIntegration:
|
||||
"""Integration tests across resource routes"""
|
||||
|
||||
def test_all_main_resource_pages_load(self, client):
|
||||
"""Test all major resource index pages load successfully"""
|
||||
pages = [
|
||||
"/biblical-angels",
|
||||
"/biblical-prophets",
|
||||
"/names-of-god",
|
||||
"/parables",
|
||||
"/biblical-covenants",
|
||||
"/the-twelve-apostles",
|
||||
"/women-of-the-bible",
|
||||
"/biblical-festivals",
|
||||
"/fruits-of-the-spirit",
|
||||
"/miracles-of-jesus",
|
||||
"/prayers-of-the-bible",
|
||||
"/beatitudes",
|
||||
"/ten-commandments",
|
||||
"/armor-of-god",
|
||||
"/i-am-statements",
|
||||
"/trinity",
|
||||
"/christology",
|
||||
"/soteriology",
|
||||
"/pneumatology",
|
||||
"/eschatology",
|
||||
"/ecclesiology",
|
||||
"/types-and-shadows",
|
||||
"/messianic-prophecies",
|
||||
"/blood-in-scripture",
|
||||
"/kingdom-of-god",
|
||||
"/names-of-christ",
|
||||
]
|
||||
|
||||
for page in pages:
|
||||
response = client.get(page)
|
||||
assert response.status_code == 200, f"Page {page} failed to load"
|
||||
|
||||
def test_resource_pages_have_html_structure(self, client):
|
||||
"""Test resource pages have valid HTML structure"""
|
||||
pages = [
|
||||
"/biblical-angels",
|
||||
"/parables",
|
||||
"/ten-commandments",
|
||||
"/trinity",
|
||||
]
|
||||
|
||||
for page in pages:
|
||||
response = client.get(page)
|
||||
if response.status_code == 200:
|
||||
content = response.content.decode()
|
||||
assert "<html" in content.lower()
|
||||
assert "<body" in content.lower()
|
||||
assert "</html>" in content.lower()
|
||||
|
||||
def test_resource_pages_have_titles(self, client):
|
||||
"""Test resource pages have proper title tags"""
|
||||
pages = [
|
||||
"/biblical-angels",
|
||||
"/parables",
|
||||
"/ten-commandments",
|
||||
"/trinity",
|
||||
]
|
||||
|
||||
for page in pages:
|
||||
response = client.get(page)
|
||||
if response.status_code == 200:
|
||||
content = response.content.decode()
|
||||
assert "<title>" in content.lower()
|
||||
|
||||
def test_resource_pages_return_html_content_type(self, client):
|
||||
"""Test HTML pages return correct content type"""
|
||||
pages = [
|
||||
"/biblical-angels",
|
||||
"/parables",
|
||||
"/ten-commandments",
|
||||
"/trinity",
|
||||
]
|
||||
|
||||
for page in pages:
|
||||
response = client.get(page)
|
||||
if response.status_code == 200:
|
||||
content_type = response.headers.get("content-type", "")
|
||||
assert "text/html" in content_type
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pytest.main([__file__, "-v"])
|
||||
Reference in New Issue
Block a user