feat: the phase-2 reset script and the proof-order contact rule (0.11)
reset_board deletes orders, quotes, cards, uploads and their history, and empties the Kanban flow folders while keeping Estampas and every setup record. It is a dry run unless --yes is passed, and never resets the order numbering. A proof order closes contact with Prova OK; orders without a proof keep their "Contato feito" action.
This commit is contained in:
32
tests/test_reset_board.py
Normal file
32
tests/test_reset_board.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""0.11 folder cleaning: empty the flow folders, keep the art library."""
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from ops.reset_board import FLOW_FOLDERS, clean_folders
|
||||
|
||||
|
||||
class ResetFoldersTests(unittest.TestCase):
|
||||
def test_empties_flow_folders_and_keeps_estampas(self):
|
||||
with tempfile.TemporaryDirectory() as folder:
|
||||
root = Path(folder)
|
||||
for name in FLOW_FOLDERS:
|
||||
(root / name).mkdir()
|
||||
(root / name / 'card.txt').write_text('x')
|
||||
library = root / 'Estampas'
|
||||
library.mkdir()
|
||||
(library / '1001.png').write_bytes(b'art')
|
||||
clean_folders(root, dry_run=False)
|
||||
for name in FLOW_FOLDERS:
|
||||
self.assertTrue((root / name).is_dir(), name)
|
||||
self.assertEqual(list((root / name).iterdir()), [], name)
|
||||
self.assertEqual((library / '1001.png').read_bytes(), b'art')
|
||||
|
||||
def test_refuses_a_folder_that_is_not_the_kanban_root(self):
|
||||
with tempfile.TemporaryDirectory() as folder:
|
||||
with self.assertRaises(SystemExit):
|
||||
clean_folders(folder, dry_run=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user