mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-23 01:16:18 +00:00
29 lines
759 B
Python
29 lines
759 B
Python
# -*- coding: utf-8 -*-
|
|
# vim:fenc=utf-8
|
|
#
|
|
# This file is part of Supysonic.
|
|
# Supysonic is a Python implementation of the Subsonic server API.
|
|
#
|
|
# Copyright (C) 2017 Alban 'spl0k' Féron
|
|
#
|
|
# Distributed under terms of the GNU AGPLv3 license.
|
|
|
|
import io
|
|
from flask import Flask
|
|
from supysonic.db import get_store
|
|
|
|
class AppMock(object):
|
|
def __init__(self, with_store = True):
|
|
self.app = Flask(__name__)
|
|
self.app.testing = True
|
|
|
|
if with_store:
|
|
self.store = get_store('sqlite:')
|
|
with io.open('schema/sqlite.sql', 'r') as sql:
|
|
schema = sql.read()
|
|
for statement in schema.split(';'):
|
|
self.store.execute(statement)
|
|
else:
|
|
self.store = None
|
|
|