Exemple #1
0
    def test_secret_key(self):
        with self.settings(DEBUG=True, IN_TEST_SUITE=False,
                           SECRET_KEY='please change this'):
            validate_settings()

        with self.settings(DEBUG=False, IN_TEST_SUITE=False,
                           SECRET_KEY='please change this'):
            with self.assertRaises(ImproperlyConfigured):
                validate_settings()

        with self.settings(DEBUG=False, IN_TEST_SUITE=False,
                           SECRET_KEY='so changed',
                           SESSION_COOKIE_SECURE=True,
                           APP_PURCHASE_SECRET='so changed'):
            validate_settings()
Exemple #2
0
    def test_secret_key(self):
        with self.settings(DEBUG=True, IN_TEST_SUITE=False,
                           SECRET_KEY='please change this'):
            validate_settings()

        with self.settings(DEBUG=False, IN_TEST_SUITE=False,
                           SECRET_KEY='please change this'):
            with self.assertRaises(ImproperlyConfigured):
                validate_settings()

        with self.settings(DEBUG=False, IN_TEST_SUITE=False,
                           SECRET_KEY='so changed',
                           SESSION_COOKIE_SECURE=True,
                           APP_PURCHASE_SECRET='so changed'):
            validate_settings()
Exemple #3
0
 def test_http_not_debug(self):
     with self.settings(CSP_IMG_SRC=('http://f.c'),
                        DEBUG=False,
                        IN_TEST_SUITE=False):
         with self.assertRaises(ImproperlyConfigured):
             validate_settings()
Exemple #4
0
 def test_http(self):
     with self.settings(CSP_IMG_SRC=('http://f.c'),
                        DEBUG=True,
                        IN_TEST_SUITE=False):
         validate_settings()
Exemple #5
0
 def test_http_not_debug(self):
     with self.settings(CSP_SCRIPT_SRC=('http://f.c'), DEBUG=False,
                        IN_TEST_SUITE=False):
         with self.assertRaises(ImproperlyConfigured):
             validate_settings()
Exemple #6
0
 def test_http(self):
     with self.settings(CSP_SCRIPT_SRC=('http://f.c'), DEBUG=True,
                        IN_TEST_SUITE=False):
         validate_settings()
Exemple #7
0
        return mod(self, arg)
    except Exception:
        trans_log.error(unicode(self))
        return ''

Markup.__mod__ = new

import djcelery
djcelery.setup_loader()

# Import for side-effect: configures our logging handlers.
# pylint: disable-msg=W0611
from lib.utils import validate_settings
from lib.log_settings_base import log_configure
log_configure()
validate_settings()

import django.conf
newrelic_ini = getattr(django.conf.settings, 'NEWRELIC_INI', None)
load_newrelic = False

# Monkey patches DRF to not use fqdn urls.
from mkt.api.patch import patch
patch()

if newrelic_ini:
    import newrelic.agent
    try:
        newrelic.agent.initialize(newrelic_ini)
        load_newrelic = True
    except:
Exemple #8
0
    except Exception:
        trans_log.error(unicode(self))
        return ''


Markup.__mod__ = new

import djcelery
djcelery.setup_loader()

# Import for side-effect: configures our logging handlers.
# pylint: disable-msg=W0611
from lib.utils import update_csp, validate_modules, validate_settings
update_csp()
validate_modules()
validate_settings()

import django.conf
newrelic_ini = getattr(django.conf.settings, 'NEWRELIC_INI', None)
load_newrelic = False

# Monkey patches DRF to not use fqdn urls.
from mkt.api.patch import patch
patch()

if newrelic_ini:
    import newrelic.agent
    try:
        newrelic.agent.initialize(newrelic_ini)
        load_newrelic = True
    except: