69 lines
1.9 KiB
Python
69 lines
1.9 KiB
Python
"""Shared test fixtures."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from cheddahbot.db import Database
|
|
|
|
|
|
@pytest.fixture()
|
|
def tmp_db(tmp_path):
|
|
"""Provide a fresh in-memory-like SQLite database."""
|
|
db_path = tmp_path / "test.db"
|
|
return Database(db_path)
|
|
|
|
|
|
@pytest.fixture()
|
|
def sample_clickup_task_data():
|
|
"""Raw ClickUp API response for a single task."""
|
|
return {
|
|
"id": "abc123",
|
|
"name": "Write PR for Acme Corp",
|
|
"description": "Draft a press release about the new product launch.",
|
|
"status": {"status": "to do", "type": "open"},
|
|
"url": "https://app.clickup.com/t/abc123",
|
|
"list": {"id": "list_1", "name": "Content Tasks"},
|
|
"custom_fields": [
|
|
{
|
|
"id": "cf_1",
|
|
"name": "Task Type",
|
|
"type": "drop_down",
|
|
"value": 0,
|
|
"type_config": {
|
|
"options": [
|
|
{"id": "opt_1", "name": "Press Release", "orderindex": 0},
|
|
{"id": "opt_2", "name": "Link Building", "orderindex": 1},
|
|
]
|
|
},
|
|
},
|
|
{
|
|
"id": "cf_2",
|
|
"name": "Company",
|
|
"type": "short_text",
|
|
"value": "Acme Corp",
|
|
},
|
|
{
|
|
"id": "cf_3",
|
|
"name": "Priority Level",
|
|
"type": "drop_down",
|
|
"value": None,
|
|
"type_config": {"options": []},
|
|
},
|
|
],
|
|
}
|
|
|
|
|
|
@pytest.fixture()
|
|
def sample_clickup_task_no_type():
|
|
"""ClickUp task with no Task Type custom field."""
|
|
return {
|
|
"id": "def456",
|
|
"name": "Random admin task",
|
|
"description": "",
|
|
"status": {"status": "to do", "type": "open"},
|
|
"url": "https://app.clickup.com/t/def456",
|
|
"list": {"id": "list_2", "name": "Admin"},
|
|
"custom_fields": [],
|
|
}
|