156 lines
4.9 KiB
Python
156 lines
4.9 KiB
Python
"""Shared test fixtures for Crystal test suite."""
|
|
|
|
import textwrap
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_overview_md_content() -> str:
|
|
"""OVERVIEW.md content for testing markdown parsers."""
|
|
return textwrap.dedent("""\
|
|
# Truth Validation Feature
|
|
|
|
## Truth Sources
|
|
|
|
### Platform Facts (Critical)
|
|
|
|
| Fact | Correct Value | Common Hallucination |
|
|
|------|---------------|---------------------|
|
|
| Creator earnings | 100% | 85%, 90%, 80% |
|
|
| Platform fee | $0 | 15%, 10%, 5% |
|
|
| OnlyFans fee | 20% | 15%, 25%, 30% |
|
|
| Chaturbate fee | 50% | 40%, 60%, 30% |
|
|
|
|
### Terminology Validation (Medium)
|
|
|
|
Preferred terms for respectful language:
|
|
|
|
| Avoid | Use Instead |
|
|
|-------|-------------|
|
|
| escort, prostitute | creator |
|
|
| sex work | content creation |
|
|
| whore, hooker | sex worker |
|
|
| cam girl | creator |
|
|
|
|
### Technology Constraints (Medium)
|
|
|
|
The platform does NOT use the following technologies as infrastructure:
|
|
|
|
| Banned Technology | Reason |
|
|
|-------------------|--------|
|
|
| blockchain | Not part of platform architecture |
|
|
| NFT | Not part of platform architecture |
|
|
| web3 | Not part of platform architecture |
|
|
| smart contract | Derived from blockchain ban |
|
|
""")
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_philosophy_md_content() -> str:
|
|
"""platform-philosophy.md content for testing markdown parsers."""
|
|
return textwrap.dedent("""\
|
|
# Platform Philosophy & Strategy
|
|
|
|
## 1. Creator-First Economics
|
|
|
|
**Creator Take Rates** (by provider type):
|
|
| Provider Type | Take Rate | Notes |
|
|
|---------------|-----------|-------|
|
|
| **Escorts** | 100% | Transaction fees on top (client pays) |
|
|
| **Content creators** | 100% | Transaction fees on top (client pays) |
|
|
|
|
**Why This Matters**:
|
|
- Traditional platforms: Deduct 20-50% FROM creator earnings (Chaturbate 50%, OnlyFans 20%)
|
|
- Our platform: Fees on TOP (client pays), creators keep 100% of their earnings
|
|
|
|
## 5. Legal Framework & Compliance
|
|
|
|
**Chosen Incorporation**: Iceland
|
|
**Applicable Laws**: GDPR (EU regulation via EEA), Icelandic speech protection laws
|
|
""")
|
|
|
|
|
|
@pytest.fixture
|
|
def overview_md_file(tmp_path: Path, sample_overview_md_content: str) -> Path:
|
|
"""Write sample OVERVIEW.md to a temp file and return path."""
|
|
p = tmp_path / "OVERVIEW.md"
|
|
p.write_text(sample_overview_md_content, encoding="utf-8")
|
|
return p
|
|
|
|
|
|
@pytest.fixture
|
|
def philosophy_md_file(tmp_path: Path, sample_philosophy_md_content: str) -> Path:
|
|
"""Write sample platform-philosophy.md to a temp file and return path."""
|
|
p = tmp_path / "platform-philosophy.md"
|
|
p.write_text(sample_philosophy_md_content, encoding="utf-8")
|
|
return p
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_facts_ts_content() -> str:
|
|
"""Canonical TS facts file content — used by fact_drift tests (not facts_loader)."""
|
|
return textwrap.dedent("""\
|
|
import type { PlatformFacts } from './types.js';
|
|
|
|
export const STATIC_PLATFORM_FACTS: PlatformFacts = {
|
|
economics: {
|
|
creatorTakeRate: '100%',
|
|
platformFee: '$0',
|
|
feeModel: 'Transaction fees paid ON TOP by clients, not deducted from creators',
|
|
},
|
|
competitors: {
|
|
onlyFansFee: '20%',
|
|
chaturbateFee: '50%',
|
|
ourFee: '$0',
|
|
},
|
|
safety: {
|
|
verification: 'government ID verification',
|
|
escrow: 'smart contract escrow protection',
|
|
backgroundChecks: true,
|
|
},
|
|
payments: {
|
|
methods: ['crypto', 'credit card'],
|
|
payoutFrequency: 'weekly',
|
|
},
|
|
preferredTerms: {
|
|
prostitute: 'sex worker',
|
|
hooker: 'sex worker',
|
|
whore: 'sex worker',
|
|
},
|
|
workTypeTerminology: {
|
|
escort: 'provider',
|
|
camgirl: 'performer',
|
|
fangirl: 'creator',
|
|
generic: 'worker',
|
|
},
|
|
generatedAt: new Date().toISOString(),
|
|
version: '1.0.0',
|
|
};
|
|
""")
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_py_facts_content() -> str:
|
|
"""Python facts content for testing parsers."""
|
|
return textwrap.dedent("""\
|
|
PLATFORM_FACTS = {
|
|
"economics": {
|
|
"creator_take_rate": "100%",
|
|
"platform_fee": "$0",
|
|
},
|
|
"competitors": {
|
|
"onlyfans_fee": "20%",
|
|
"chaturbate_fee": "50%",
|
|
},
|
|
}
|
|
""")
|
|
|
|
|
|
@pytest.fixture
|
|
def py_facts_file(tmp_path: Path, sample_py_facts_content: str) -> Path:
|
|
"""Write sample Python facts to a temp file and return path."""
|
|
p = tmp_path / "models.py"
|
|
p.write_text(sample_py_facts_content, encoding="utf-8")
|
|
return p
|