Initial shared Stardew Valley tracker
This commit is contained in:
commit
a33f7a297d
14 changed files with 1171 additions and 0 deletions
35
tests/test_app.py
Normal file
35
tests/test_app.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
import app
|
||||
|
||||
|
||||
class StoreTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.temp = tempfile.TemporaryDirectory()
|
||||
self.store = app.Store(Path(self.temp.name) / "state.sqlite3")
|
||||
self.store.initialize()
|
||||
|
||||
def tearDown(self):
|
||||
self.temp.cleanup()
|
||||
|
||||
def test_empty_store(self):
|
||||
self.assertEqual(self.store.snapshot()["checks"], {})
|
||||
self.assertEqual(self.store.snapshot()["revision"], 0)
|
||||
|
||||
def test_shared_check_round_trip(self):
|
||||
result = self.store.set_check("crop-parsnip", True, "fred")
|
||||
self.assertEqual(result["revision"], 1)
|
||||
snapshot = self.store.snapshot()
|
||||
self.assertTrue(snapshot["checks"]["crop-parsnip"])
|
||||
self.assertEqual(snapshot["updatedBy"], "fred")
|
||||
|
||||
self.store.set_check("crop-parsnip", False, "kayla")
|
||||
snapshot = self.store.snapshot()
|
||||
self.assertFalse(snapshot["checks"]["crop-parsnip"])
|
||||
self.assertEqual(snapshot["revision"], 2)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue