diff options
Diffstat (limited to 'Biz/PodcastItLater/Web.py')
| -rw-r--r-- | Biz/PodcastItLater/Web.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Biz/PodcastItLater/Web.py b/Biz/PodcastItLater/Web.py index b471a29..86b2099 100644 --- a/Biz/PodcastItLater/Web.py +++ b/Biz/PodcastItLater/Web.py @@ -50,7 +50,14 @@ from typing import override logger = Log.setup() # Configuration -DATABASE_PATH = os.getenv("DATABASE_PATH", "podcast.db") +area = App.from_env() +if area == App.Area.Test: + DATABASE_PATH = os.getenv( + "DATABASE_PATH", + "_/var/podcastitlater/podcast.db", + ) +else: + DATABASE_PATH = os.getenv("DATABASE_PATH", "/var/podcastitlater/podcast.db") BASE_URL = os.getenv("BASE_URL", "http://localhost:8000") PORT = int(os.getenv("PORT", "8000")) @@ -1751,7 +1758,11 @@ class BaseWebTest(Test.TestCase): def setUp(self) -> None: """Set up test database and client.""" # Create a test database context - self.test_db_path = "test_podcast_web.db" + self.test_db_path = "_/var/podcastitlater/test_podcast_web.db" + + # Ensure test directory exists + test_db_dir = pathlib.Path(self.test_db_path).parent + test_db_dir.mkdir(parents=True, exist_ok=True) # Save original database path self._original_db_path = globals()["_test_database_path"] |
