Skip to content

Commit

Permalink
tests: add instance sync test
Browse files Browse the repository at this point in the history
  • Loading branch information
kraanzu committed Sep 28, 2024
1 parent 0cd6fc6 commit 498f5d4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/test_core/test_sync.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from pathlib import Path
from dooit.api.manager import Manager
from dooit.api.workspace import Workspace
from tests.test_core.core_base import CoreTestBase
import tempfile

class TestSync(CoreTestBase):
def test_sync(self):

# create a temporary folder
temp_folder = tempfile.TemporaryDirectory(delete = False)
temp_db = Path(temp_folder.name) / "dooit1.db"
TEMP_CONN = f"sqlite:////{temp_db}"

manager1 = Manager()
manager2 = Manager()

manager1.register_engine(TEMP_CONN)
manager2.register_engine(TEMP_CONN)

w = Workspace(description="test")
manager1.save(w)

self.assertFalse(manager1.has_changed())
self.assertTrue(manager2.has_changed())

temp_folder.cleanup()

0 comments on commit 498f5d4

Please sign in to comment.