source: flexoentity/tests/test_sqlite_backend.py@ c1144fd

unify_backends
Last change on this file since c1144fd was 3389960, checked in by Enrico Schwass <ennoausberlin@…>, 3 days ago

redesign of Identity and PersistanceBackends - this is a breaking change.

  • Property mode set to 100644
File size: 607 bytes
Line 
1import sqlite3
2from flexoentity.domain import Domain
3from flexoentity import SQLiteEntityBackend
4
5
6def test_sqlite_roundtrip(tmp_path, sample_domain):
7 db_path = tmp_path / "domains.db"
8 conn = sqlite3.connect(db_path)
9 conn.row_factory = sqlite3.Row
10
11 backend = SQLiteEntityBackend(Domain, conn, table_name="domains")
12
13 backend.save(sample_domain.to_dict())
14
15 loaded = backend.load(sample_domain.flexo_id)
16 assert loaded == sample_domain.to_dict()
17
18 all_loaded = backend.load_all()
19 assert len(all_loaded) == 1
20 assert Domain.from_dict(all_loaded[0]).domain_id == "PY_ARITHM"
Note: See TracBrowser for help on using the repository browser.