trustgraph/tests/unit/test_api.py
elpresidank 74cc8a4685 Squashed 'ai-context/trustgraph-templates/' content from commit 42a5fd1b
git-subtree-dir: ai-context/trustgraph-templates
git-subtree-split: 42a5fd1b678f32be378062e30451e2052ccb95dd
2026-04-05 21:09:49 -05:00

38 lines
1.2 KiB
Python

"""
Unit tests for Index class.
"""
import pytest
from trustgraph_configurator import Index
@pytest.mark.unit
class TestAPI:
"""Tests for the Index class."""
def test_get_templates_returns_list(self):
"""Test that get_templates returns a list."""
templates = Index.get_templates()
assert isinstance(templates, list)
assert len(templates) > 0
def test_templates_have_required_fields(self):
"""Test that templates have name and version fields."""
templates = Index.get_templates()
for template in templates:
assert hasattr(template, 'name')
assert hasattr(template, 'version')
def test_get_latest_returns_template(self):
"""Test that get_latest returns a template."""
latest = Index.get_latest()
assert latest is not None
assert hasattr(latest, 'name')
assert hasattr(latest, 'version')
def test_get_latest_stable_returns_template(self):
"""Test that get_latest_stable returns a template."""
latest_stable = Index.get_latest_stable()
assert latest_stable is not None
assert hasattr(latest_stable, 'name')
assert hasattr(latest_stable, 'version')