mirror of
https://github.com/Casvt/MIND.git
synced 2026-04-25 03:00:20 -04:00
Refactored backend (Fixes #87)
This commit is contained in:
26
tests/Tbackend/db_test.py
Normal file
26
tests/Tbackend/db_test.py
Normal 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
|
||||
)
|
||||
Reference in New Issue
Block a user