17 lines
583 B
Python
17 lines
583 B
Python
from data.models.TwitchComponent import TwitchComponent
|
|
from libs.Db import Db
|
|
|
|
|
|
def test_db_creates_tables_and_model_defaults(env_tmp_db):
|
|
db = Db(env_tmp_db, echo=False)
|
|
|
|
# On first use, tables should be created and we can insert a model
|
|
rec = TwitchComponent(name="twitch_bot.commands.example")
|
|
db.session.add(rec)
|
|
db.session.commit()
|
|
|
|
fetched = db.session.query(TwitchComponent).filter_by(name="twitch_bot.commands.example").first()
|
|
assert fetched is not None
|
|
# Default for 'active' should be True unless changed
|
|
assert fetched.active is True
|