From af54db6c136138c66cf5ca72419989525a0baa5c Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Tue, 7 Aug 2018 15:09:08 +0100 Subject: Initial project layout for django --- tests/__init__.py | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 tests/__init__.py (limited to 'tests/__init__.py') diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index 1f3ca1a4..00000000 --- a/tests/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -import os - -from flask import Blueprint -from flask_testing import TestCase - -os.environ["BOT_API_KEY"] = "abcdefg" # This is a constant, must be done first -os.environ["PAPERTRAIL_ADDRESS"] = 'localhost' # satisfies coverage -os.environ["DATADOG_ADDRESS"] = 'localhost' # satisfies coverage - -if "FLASK_DEBUG" in os.environ: - del os.environ["FLASK_DEBUG"] # Some unit tests fail if this is set - -from app import manager -from gunicorn_config import _when_ready as when_ready - -when_ready() - -manager.app.tests_blueprint = Blueprint("tests", __name__) -manager.load_views(manager.app.tests_blueprint, "pysite/views/tests") -manager.app.register_blueprint(manager.app.tests_blueprint) -app = manager.app - -app.config["WTF_CSRF_CHECK_DEFAULT"] = False - - -class SiteTest(TestCase): - """ Extend TestCase with flask app instantiation """ - - def create_app(self): - """ Add flask app configuration settings """ - server_name = 'pytest.local' - - app.config['TESTING'] = True - app.config['LIVESERVER_TIMEOUT'] = 10 - app.config['SERVER_NAME'] = server_name - app.config['API_SUBDOMAIN'] = f'http://api.{server_name}' - app.config['STAFF_SUBDOMAIN'] = f'http://staff.{server_name}' - app.config['WIKI_SUBDOMAIN'] = f'http://wiki.{server_name}' - app.config['TEST_HEADER'] = {'X-API-Key': 'abcdefg', 'Content-Type': 'application/json'} - app.allow_subdomain_redirects = True - - return app -- cgit v1.2.3