FreedomBox/plinth/tests/runtests.py
Joseph Nuthalpati 995365f3df
Add SSO using auth_pubtkt for 3 web apps
- Install mod_auth_pubtkt and generate public/private key-pair.

- Redirect user to login page if no cookie is presented.

- Add check for authenticated user for login page.

- Temporarily switched to DSA because of a bug in mod_auth_pubtkt
  which causes it to accept only DSA and not RSA. Also had to use SHA1
  instead of SHA256.

- Enabled SSO for Syncthing, Repro and TT-RSS.

- Using tokens to authorize by user groups.

- Generate keys during first boot.
2017-06-03 10:29:42 -04:00

54 lines
1.5 KiB
Python

#!/usr/bin/python3
#
# This file is part of Plinth.
#
# 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.
#
# 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 <http://www.gnu.org/licenses/>.
#
"""
Module for Django pre-test configuration and setup.
"""
import os
import sys
import django
from django.conf import settings
from django.test.utils import get_runner
def run_tests(pattern=None, return_to_caller=False):
"""Set up the Django test environment and run the specified tests."""
os.environ['DJANGO_SETTINGS_MODULE'] = \
'plinth.tests.data.django_test_settings'
django.setup()
test_runner_cls = get_runner(settings)
test_runner = test_runner_cls()
if pattern is None:
pattern_list = [
'plinth/tests',
'plinth/modules',
]
else:
pattern_list = [pattern]
failures = test_runner.run_tests(pattern_list)
if failures > 0 or not return_to_caller:
sys.exit(bool(failures))
if __name__ == '__main__':
run_tests()