system-prompts-and-models-o.../personal-brand-engine/tests/test_models.py
VoXc2 4bb2442313
Add Personal Brand Engine - 7 AI Agents Automation System
Complete AI-powered personal brand automation for Sami Assiri.\n\n7 agents: LinkedIn, Email, Social Media, WhatsApp, CV Optimizer, Content Strategist, Opportunity Scout.\nInfra: FastAPI + APScheduler + Docker + Ollama/Groq LLM + GitHub Pages landing page.\n83 files, ~10K lines. Cost: $0-5/month.
2026-03-30 11:45:48 +03:00

64 lines
1.6 KiB
Python

"""Tests for database models."""
import sys
from pathlib import Path
from datetime import datetime, timezone
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
def test_database_init():
"""Database should initialize and create tables."""
import os
os.environ["DATABASE_URL"] = "sqlite:///./test_brand.db"
from storage.database import init_db, get_db
from storage.models import Base
init_db()
db = get_db()
db.close()
# Cleanup
if Path("test_brand.db").exists():
Path("test_brand.db").unlink()
def test_post_model():
"""Post model should be creatable."""
from storage.models import Post
post = Post(
platform="linkedin",
content="Test post",
status="draft",
)
assert post.platform == "linkedin"
assert post.status == "draft"
def test_opportunity_model():
"""Opportunity model should be creatable."""
from storage.models import Opportunity
opp = Opportunity(
source="linkedin",
title="Field Engineer",
company="Smiths Detection",
url="https://example.com",
description="Test job",
relevance_score=0.85,
status="new",
)
assert opp.relevance_score == 0.85
assert opp.source == "linkedin"
def test_agent_log_model():
"""AgentLog model should be creatable."""
from storage.models import AgentLog
log = AgentLog(
agent_name="linkedin",
task="post_content",
status="success",
details="Posted successfully",
duration_seconds=1.5,
)
assert log.agent_name == "linkedin"
assert log.duration_seconds == 1.5