ensure in-memory db mock is used

This commit is contained in:
evilchili 2022-12-17 12:49:08 -08:00
parent 9eb5f009e6
commit f526b42d65
2 changed files with 19 additions and 2 deletions

View File

@ -10,6 +10,8 @@ from groove.playlist import Playlist
from sqlalchemy import create_engine, insert
from sqlalchemy.orm import sessionmaker
from unittest.mock import MagicMock
@pytest.fixture(autouse=True, scope='function')
def env():
@ -26,8 +28,11 @@ def auth():
@pytest.fixture(scope='function')
def in_memory_engine():
return create_engine('sqlite:///:memory:', future=True)
def in_memory_engine(monkeypatch):
engine = create_engine('sqlite:///:memory:', future=True)
monkeypatch.setattr('groove.db.manager.create_engine',
MagicMock(return_value=engine))
return engine
@pytest.fixture(scope='function')

View File

@ -0,0 +1,12 @@
[styles]
text = #999999
bright = #f1f2f6
bold = #f1f2f6 bold
dim = #555555
link = #9999FF
prompt = #f1f2f6 bold
artist = #017D93
title = #70bc45
help = #999999
background = #001321
error = #FF8888