Files
claude-config/bin/do_epic/backend/test_fake.py
T
2026-11-18 18:07:12 +01:00

35 lines
1.2 KiB
Python

import pathlib
import sys
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
from do_epic.backend.contract import EpicStoreContract
from failure import Failure
from do_epic.backend.fake import MemoryEpic
class MemoryEpicContract(EpicStoreContract, unittest.TestCase):
def new_store(self) -> MemoryEpic:
return MemoryEpic("ABC-12")
def assign(self, store: MemoryEpic, key: str, name: str) -> None: # type: ignore[override]
store.change(key, assignee=name)
def comments_on(self, store: MemoryEpic, key: str) -> list[str]: # type: ignore[override]
return store.comments.get(key, [])
def close(self, store: MemoryEpic, key: str, status: str) -> None: # type: ignore[override]
store.change(key, status=status, done=True)
class Failing(unittest.TestCase):
def test_every_read_filing_label_and_comment_fails_with_the_reason_given(self) -> None:
store = MemoryEpic("ABC-12", fails="Jira is down")
down = Failure("Jira is down")
self.assertEqual((store.read(), store.file("ABC-12", "Count the runs.", "", ()), store.add_label("ABC-100", "api"), store.comment("ABC-100", "Hello.")), (down, down, down, down))
if __name__ == "__main__":
unittest.main()