summaryrefslogtreecommitdiff
path: root/Biz/PodcastItLater/TESTING.md
blob: 2911610cb2c1a6c077e0ee5e22eec6bf545af0a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# PodcastItLater Testing Strategy

## Overview
We use `pytest` with `Omni.Test` integration. Tests are co-located with code or in `Biz/PodcastItLater/Test.py` for E2E.

## Test Categories

### 1. Core (Database/Logic)
- **Location**: `Biz/PodcastItLater/Core.py`
- **Scope**: User creation, Job queue ops, Episode management.
- **Key Tests**:
    - `test_create_user`: Unique tokens.
    - `test_queue_isolation`: Users see only their jobs.

### 2. Web (HTTP/UI)
- **Location**: `Biz/PodcastItLater/Web.py`
- **Scope**: Routes, Auth, HTMX responses.
- **Key Tests**:
    - `test_submit_requires_auth`.
    - `test_rss_feed_xml`.
    - `test_admin_access_control`.

### 3. Worker (Processing)
- **Location**: `Biz/PodcastItLater/Worker.py`
- **Scope**: Extraction, TTS, S3 upload.
- **Key Tests**:
    - `test_extract_content`: Mocked network calls.
    - `test_tts_chunking`: Handle long text.
    - **Error Handling**: Ensure retries work and errors are logged.

### 4. Billing (Stripe)
- **Location**: `Biz/PodcastItLater/Billing.py`
- **Scope**: Webhook processing, Entitlement checks.
- **Key Tests**:
    - `test_webhook_subscription_update`: Update local DB.
    - `test_enforce_limits`: Block submission if over limit.

## Running Tests
```bash
# Run all
bild --test Biz/PodcastItLater.hs

# Run specific file
./Biz/PodcastItLater/Web.py test
```