diff --git a/setup.py b/setup.py
index e36ccca..a154188 100755
--- a/setup.py
+++ b/setup.py
@@ -33,5 +33,6 @@ setup(
parse_requirements('requirements.txt', session=PipSession())],
scripts=['bin/supysonic-cli', 'bin/supysonic-watcher'],
zip_safe=False,
- include_package_data=True
+ include_package_data=True,
+ test_suite="tests.suite"
)
diff --git a/supysonic/frontend/__init__.py b/supysonic/frontend/__init__.py
index d5e5778..6f6fadb 100644
--- a/supysonic/frontend/__init__.py
+++ b/supysonic/frontend/__init__.py
@@ -1,22 +1,13 @@
-# coding: utf-8
-
+# -*- 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) 2014 Alban 'spl0k' Féron
#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# Copyright (C) 2013-2017 Alban 'spl0k' Féron
+# 2017 Óscar García Amor
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# Distributed under terms of the GNU AGPLv3 license.
from flask import session
from supysonic.web import app, store
@@ -27,32 +18,32 @@ app.add_template_filter(str)
@app.before_request
def login_check():
- if request.path.startswith('/rest/'):
- return
+ if request.path.startswith('/rest/'):
+ return
- if request.path.startswith('/static/'):
- return
+ if request.path.startswith('/static/'):
+ return
- if request.endpoint != 'login':
- should_login = False
- if not session.get('userid'):
- should_login = True
- elif UserManager.get(store, session.get('userid'))[0] != UserManager.SUCCESS:
- session.clear()
- should_login = True
+ if request.endpoint != 'login':
+ should_login = False
+ if not session.get('userid'):
+ should_login = True
+ elif UserManager.get(store, session.get('userid'))[0] != UserManager.SUCCESS:
+ session.clear()
+ should_login = True
- if should_login:
- flash('Please login')
- return redirect(url_for('login', returnUrl = request.script_root + request.url[len(request.url_root)-1:]))
+ if should_login:
+ flash('Please login')
+ return redirect(url_for('login', returnUrl = request.script_root + request.url[len(request.url_root)-1:]))
@app.route('/')
def index():
- stats = {
- 'artists': store.find(Artist).count(),
- 'albums': store.find(Album).count(),
- 'tracks': store.find(Track).count()
- }
- return render_template('home.html', stats = stats, admin = UserManager.get(store, session.get('userid'))[1].admin)
+ stats = {
+ 'artists': store.find(Artist).count(),
+ 'albums': store.find(Album).count(),
+ 'tracks': store.find(Track).count()
+ }
+ return render_template('home.html', stats = stats, admin = UserManager.get(store, session.get('userid'))[1].admin)
from .user import *
from .folder import *
diff --git a/tests/__init__.py b/tests/__init__.py
index d3e8bcd..bd00f37 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,12 +1,25 @@
-#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
-# Copyright © 2017 Óscar García Amor
+# This file is part of Supysonic.
+# Supysonic is a Python implementation of the Subsonic server API.
#
-# Distributed under terms of the GNU GPLv3 license.
+# Copyright (C) 2013-2017 Alban 'spl0k' Féron
+# 2017 Óscar García Amor
+#
+# Distributed under terms of the GNU AGPLv3 license.
+
+import unittest
from .test_manager_folder import FolderManagerTestCase
from .test_manager_user import UserManagerTestCase
from .test_api import ApiTestCase
from .test_frontend import FrontendTestCase
+
+def suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(FolderManagerTestCase))
+ suite.addTest(unittest.makeSuite(UserManagerTestCase))
+ suite.addTest(unittest.makeSuite(ApiTestCase))
+ suite.addTest(unittest.makeSuite(FrontendTestCase))
+ return suite
diff --git a/tests/test_api.py b/tests/test_api.py
index 52c80cf..5afd8f0 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -1,10 +1,14 @@
-#! /usr/bin/env python
+#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
-# Copyright © 2017 Óscar García Amor
+# This file is part of Supysonic.
+# Supysonic is a Python implementation of the Subsonic server API.
#
-# Distributed under terms of the GNU GPLv3 license.
+# Copyright (C) 2013-2017 Alban 'spl0k' Féron
+# 2017 Óscar García Amor
+#
+# Distributed under terms of the GNU AGPLv3 license.
from supysonic import db
from supysonic.managers.user import UserManager
diff --git a/tests/test_frontend.py b/tests/test_frontend.py
index d3a77c1..f7d8d26 100644
--- a/tests/test_frontend.py
+++ b/tests/test_frontend.py
@@ -1,10 +1,14 @@
-#! /usr/bin/env python
+#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
-# Copyright © 2017 Óscar García Amor
+# This file is part of Supysonic.
+# Supysonic is a Python implementation of the Subsonic server API.
#
-# Distributed under terms of the GNU GPLv3 license.
+# Copyright (C) 2013-2017 Alban 'spl0k' Féron
+# 2017 Óscar García Amor
+#
+# Distributed under terms of the GNU AGPLv3 license.
from supysonic import db
from supysonic.managers.user import UserManager
diff --git a/tests/test_manager_folder.py b/tests/test_manager_folder.py
index bfd8d66..9cbcea3 100644
--- a/tests/test_manager_folder.py
+++ b/tests/test_manager_folder.py
@@ -1,10 +1,14 @@
-#! /usr/bin/env python
+#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
-# Copyright © 2017 Óscar García Amor
+# This file is part of Supysonic.
+# Supysonic is a Python implementation of the Subsonic server API.
#
-# Distributed under terms of the GNU GPLv3 license.
+# Copyright (C) 2013-2017 Alban 'spl0k' Féron
+# 2017 Óscar García Amor
+#
+# Distributed under terms of the GNU AGPLv3 license.
from supysonic import db
from supysonic.managers.folder import FolderManager
diff --git a/tests/test_manager_user.py b/tests/test_manager_user.py
index 38ee23c..3194ddd 100644
--- a/tests/test_manager_user.py
+++ b/tests/test_manager_user.py
@@ -1,10 +1,14 @@
-#! /usr/bin/env python
+#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
-# Copyright © 2017 Óscar García Amor
+# This file is part of Supysonic.
+# Supysonic is a Python implementation of the Subsonic server API.
#
-# Distributed under terms of the GNU GPLv3 license.
+# Copyright (C) 2013-2017 Alban 'spl0k' Féron
+# 2017 Óscar García Amor
+#
+# Distributed under terms of the GNU AGPLv3 license.
from supysonic import db
from supysonic.managers.user import UserManager