1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-23 01:16:18 +00:00
supysonic/tests/base/test_secret.py

46 lines
1.1 KiB
Python
Raw Normal View History

2018-04-01 10:32:36 +00:00
#!/usr/bin/env python
# coding: utf-8
#
# This file is part of Supysonic.
# Supysonic is a Python implementation of the Subsonic server API.
#
# Copyright (C) 2018 Alban 'spl0k' Féron
#
# Distributed under terms of the GNU AGPLv3 license.
import unittest
import shutil
import tempfile
from supysonic.db import init_database, release_database
from supysonic.web import create_application
from ..testbase import TestConfig
2019-06-29 15:25:44 +00:00
2018-04-01 10:32:36 +00:00
class SecretTestCase(unittest.TestCase):
def setUp(self):
self.__dir = tempfile.mkdtemp()
self.config = TestConfig(False, False)
self.config.BASE["database_uri"] = "sqlite://"
2019-06-29 15:25:44 +00:00
self.config.WEBAPP["cache_dir"] = self.__dir
2018-04-01 10:32:36 +00:00
2019-06-29 15:25:44 +00:00
init_database(self.config.BASE["database_uri"])
2018-04-01 10:32:36 +00:00
release_database()
def tearDown(self):
shutil.rmtree(self.__dir)
def test_key(self):
app1 = create_application(self.config)
release_database()
app2 = create_application(self.config)
release_database()
self.assertEqual(app1.secret_key, app2.secret_key)
2019-06-29 15:25:44 +00:00
if __name__ == "__main__":
unittest.main()