Bootstrap tamq local tmux agent message queue
Some checks failed
tamq-ci / test (push) Failing after 36s
Some checks failed
tamq-ci / test (push) Failing after 36s
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a02f34-ead4-7a60-85cd-d7f08e22fa0e
This commit is contained in:
parent
521bbe5afc
commit
4d915a2617
58 changed files with 1882 additions and 1 deletions
29
tests/test_purge.py
Normal file
29
tests/test_purge.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import json
|
||||
|
||||
from tamq.cli import main
|
||||
from tamq.store import Store
|
||||
|
||||
|
||||
def test_purge_dry_run_does_not_delete(tmp_path, monkeypatch, capsys):
|
||||
state = tmp_path / "state"
|
||||
monkeypatch.setenv("TAMQ_STATE_DIR", str(state))
|
||||
store = Store(state / "tamq.sqlite3")
|
||||
store.add("a", "b", "body")
|
||||
store.close()
|
||||
assert main(["purge"]) == 0
|
||||
assert "Dry run" in capsys.readouterr().out
|
||||
store = Store(state / "tamq.sqlite3")
|
||||
assert len(store.list()) == 1
|
||||
|
||||
|
||||
def test_purge_confirmed_deletes(tmp_path, monkeypatch, capsys):
|
||||
state = tmp_path / "state"
|
||||
monkeypatch.setenv("TAMQ_STATE_DIR", str(state))
|
||||
store = Store(state / "tamq.sqlite3")
|
||||
store.add("a", "b", "body")
|
||||
store.db.execute("UPDATE messages SET created_at=created_at-400*86400")
|
||||
store.db.commit()
|
||||
store.close()
|
||||
assert main(["purge", "--yes"]) == 0
|
||||
assert "Purged" in capsys.readouterr().out
|
||||
assert len(Store(state / "tamq.sqlite3").list()) == 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue