Refactored backend (Fixes #87)

This commit is contained in:
CasVT
2025-04-22 23:29:35 +02:00
parent 401c97308b
commit 0cbb03151f
65 changed files with 6974 additions and 5014 deletions

26
tests/Tbackend/db_test.py Normal file
View File

@@ -0,0 +1,26 @@
import unittest
from os.path import join
from flask import Flask
from backend.base.helpers import folder_path
from backend.internals.db import Constants, DBConnection, close_db
class Test_DB(unittest.TestCase):
def test_foreign_key_and_wal(self):
app = Flask(__name__)
app.teardown_appcontext(close_db)
DBConnection.file = join(
folder_path(*Constants.DB_FOLDER),
Constants.DB_NAME
)
with app.app_context():
instance = DBConnection(timeout=Constants.DB_TIMEOUT)
self.assertEqual(
instance.cursor().execute(
"PRAGMA foreign_keys;"
).fetchone()[0],
1
)