-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8c7d6be
commit d3e01f0
Showing
2 changed files
with
39 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from app.data_migrations import populate_counters | ||
from app.db.models.app.counters import CountedEntity, EntityCounter | ||
|
||
|
||
def test_import_id_generation(test_db): | ||
populate_counters(test_db) | ||
rows = test_db.query(EntityCounter).count() | ||
assert rows > 0 | ||
|
||
row: EntityCounter = ( | ||
test_db.query(EntityCounter).filter(EntityCounter.prefix == "CCLW").one() | ||
) | ||
assert row is not None | ||
|
||
assert row.prefix == "CCLW" | ||
assert row.counter == 0 | ||
|
||
import_id = row.create_import_id(CountedEntity.Family) | ||
assert import_id == "CCLW.family.i00000001.n0001" | ||
|
||
row: EntityCounter = ( | ||
test_db.query(EntityCounter).filter(EntityCounter.prefix == "CCLW").one() | ||
) | ||
assert row.counter == 1 |