forked from ApexOpsStudio/ai-gitops-test-target
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_task.py
More file actions
30 lines (21 loc) · 747 Bytes
/
test_task.py
File metadata and controls
30 lines (21 loc) · 747 Bytes
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
"""Basic tests for task CLI."""
import json
import pytest
from pathlib import Path
from commands.add import add_task, validate_description
from commands.done import validate_task_id
def test_validate_description():
"""Test description validation."""
assert validate_description(" test ") == "test"
with pytest.raises(ValueError):
validate_description("")
with pytest.raises(ValueError):
validate_description("x" * 201)
def test_validate_task_id():
"""Test task ID validation."""
tasks = [{"id": 1}, {"id": 2}]
assert validate_task_id(tasks, 1) == 1
with pytest.raises(ValueError):
validate_task_id(tasks, 0)
with pytest.raises(ValueError):
validate_task_id(tasks, 99)