24 lines
967 B
Python
24 lines
967 B
Python
import pytest
|
|
from src.models import Ticket
|
|
|
|
def test_ticket_has_manual_block_field():
|
|
t = Ticket(id="T-001", description="Test")
|
|
assert hasattr(t, 'manual_block'), "Ticket must have manual_block field"
|
|
assert t.manual_block == False, "manual_block should default to False"
|
|
|
|
def test_mark_manual_block_method():
|
|
t = Ticket(id="T-001", description="Test")
|
|
t.mark_manual_block("Test reason")
|
|
assert t.status == "blocked", "Status should be blocked"
|
|
assert t.manual_block == True, "manual_block should be True"
|
|
assert "[MANUAL]" in t.blocked_reason, "blocked_reason should contain [MANUAL]"
|
|
|
|
def test_clear_manual_block_method():
|
|
t = Ticket(id="T-001", description="Test")
|
|
t.mark_manual_block("Test reason")
|
|
assert t.manual_block == True
|
|
t.clear_manual_block()
|
|
assert t.status == "todo", "Status should be restored to todo"
|
|
assert t.manual_block == False, "manual_block should be False"
|
|
assert t.blocked_reason is None, "blocked_reason should be cleared"
|