Files
Shortumation/api/tests/unittests/automations_v2/utils.py
T
2022-08-14 15:31:42 -04:00

20 lines
443 B
Python

from pathlib import Path
from unittest import TestCase
from tempfile import mktemp
from src.automations_v2.db import AutomationDBConnection
def make_temp_db():
return AutomationDBConnection(Path(mktemp() + ".db"))
class TestWithDB(TestCase):
def setUp(self) -> None:
self.db = make_temp_db()
self.db.create_db()
self.db_file = self.db.db_file
def tearDown(self) -> None:
self.db_file.unlink()