Feat: start sqlite tribe repository
This commit is contained in:
31
tests/integration/test_repository_sqlite.py
Normal file
31
tests/integration/test_repository_sqlite.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from backend.adapters.sqlite import create_db
|
||||
from backend.model.tribe import Tribe
|
||||
from backend.repository.tribe_sqlite_repository import TribeSQLiteRepository
|
||||
|
||||
|
||||
def populate_tribe(conn) -> None:
|
||||
cursor = conn.cursor()
|
||||
tribes = [
|
||||
("Tribe1", "2nd"),
|
||||
("Tribe2", "2nd"),
|
||||
("Tribe3", "1ST"),
|
||||
]
|
||||
cursor.executemany(
|
||||
"""
|
||||
INSERT INTO tribes(name, level) VALUES (?, ?)
|
||||
""",
|
||||
tribes,
|
||||
)
|
||||
conn.commit()
|
||||
|
||||
return [Tribe(*t) for t in tribes]
|
||||
|
||||
|
||||
def test_list_tribes(sqlite_conn):
|
||||
create_db(sqlite_conn)
|
||||
prebuild_tribes = populate_tribe(sqlite_conn)
|
||||
|
||||
tribe_repo = TribeSQLiteRepository(sqlite_conn)
|
||||
tribes = tribe_repo.list()
|
||||
|
||||
assert prebuild_tribes == tribes
|
||||
Reference in New Issue
Block a user