From 892b8bf7cd1ecc9b3b75d9355515b622acab8854 Mon Sep 17 00:00:00 2001
From: Neda Moeini <neda.moeini@geant.org>
Date: Fri, 14 Mar 2025 10:42:29 +0100
Subject: [PATCH] Add SQLite for unit tests

---
 test/settings.py | 14 +++++++++++---
 tox.ini          |  4 ++++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/test/settings.py b/test/settings.py
index 225f265..d6f0429 100644
--- a/test/settings.py
+++ b/test/settings.py
@@ -2,6 +2,14 @@
 
 from sage_validation.settings import *  # noqa: F403
 
-DATABASES = {
-    "default": DATABASES["default"],  # noqa: F405
-}
+if os.getenv("USE_SQLITE", "false").lower() == "true":  # noqa: F405
+    DATABASES = {
+        "default": {
+            "ENGINE": "django.db.backends.sqlite3",
+            "NAME": "sage_validation",
+        }
+    }
+else:
+    DATABASES = {
+        "default": DATABASES["default"],
+    }
diff --git a/tox.ini b/tox.ini
index 9380288..1db7951 100644
--- a/tox.ini
+++ b/tox.ini
@@ -6,6 +6,10 @@ deps =
     mypy
     ruff
     -r requirements.txt
+
+setenv =
+    USE_SQLITE = true
+
 commands =
     ruff check .
     mypy .
-- 
GitLab