Esempio n. 1
0
def test_get_list_of_str():
    """
    get_list_of_str should parse a list of strings
    """
    with patch('micromasters.envs.os', environ=FAKE_ENVIRONS):
        assert get_list_of_str('list_of_str', ['noth', 'ing']) == ['x', 'y', 'z']

        for key, value in FAKE_ENVIRONS.items():
            if key != 'list_of_str':
                with pytest.raises(EnvironmentVariableParseException) as ex:
                    get_list_of_str(key, ['noth', 'ing'])
                assert ex.value.args[0] == 'Expected value in {key}={value} to be a list of str'.format(
                    key=key,
                    value=value,
                )

        assert get_list_of_str('missing', 'default') == 'default'
Esempio n. 2
0
def test_get_list_of_str():
    """
    get_list_of_str should parse a list of strings
    """
    with patch('micromasters.envs.os', environ=FAKE_ENVIRONS):
        assert get_list_of_str('list_of_str',
                               ['noth', 'ing']) == ['x', 'y', 'z']

        for key, value in FAKE_ENVIRONS.items():
            if key != 'list_of_str':
                with pytest.raises(EnvironmentVariableParseException) as ex:
                    get_list_of_str(key, ['noth', 'ing'])
                assert ex.value.args[
                    0] == 'Expected value in {key}={value} to be a list of str'.format(
                        key=key,
                        value=value,
                    )

        assert get_list_of_str('missing', 'default') == 'default'
Esempio n. 3
0
SECRET_KEY = get_string(
    'SECRET_KEY',
    '36boam8miiz0c22il@3&gputb=wrqr2plah=0#0a_bknw9(2^r'
)

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = get_bool('DEBUG', False)

if DEBUG:
    # Disabling the protection added in 1.10.3 against a DNS rebinding vulnerability:
    # https://docs.djangoproject.com/en/1.10/releases/1.10.3/#dns-rebinding-vulnerability-when-debug-true
    # Because we never debug against production data, we are not vulnerable
    # to this problem.
    ALLOWED_HOSTS = ['*']
else:
    ALLOWED_HOSTS = get_list_of_str('ALLOWED_HOSTS', [])

SECURE_SSL_REDIRECT = get_bool('MICROMASTERS_SECURE_SSL_REDIRECT', True)


WEBPACK_LOADER = {
    'DEFAULT': {
        'CACHE': not DEBUG,
        'BUNDLE_DIR_NAME': 'bundles/',
        'STATS_FILE': os.path.join(BASE_DIR, 'webpack-stats.json'),
        'POLL_INTERVAL': 0.1,
        'TIMEOUT': None,
        'IGNORE': [
            r'.+\.hot-update\.+',
            r'.+\.js\.map'
        ]
Esempio n. 4
0
SECRET_KEY = get_string(
    'SECRET_KEY',
    '36boam8miiz0c22il@3&gputb=wrqr2plah=0#0a_bknw9(2^r'
)

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = get_bool('DEBUG', False)

if DEBUG:
    # Disabling the protection added in 1.10.3 against a DNS rebinding vulnerability:
    # https://docs.djangoproject.com/en/1.10/releases/1.10.3/#dns-rebinding-vulnerability-when-debug-true
    # Because we never debug against production data, we are not vulnerable
    # to this problem.
    ALLOWED_HOSTS = ['*']
else:
    ALLOWED_HOSTS = get_list_of_str('ALLOWED_HOSTS', [])

SECURE_SSL_REDIRECT = get_bool('MICROMASTERS_SECURE_SSL_REDIRECT', True)


WEBPACK_LOADER = {
    'DEFAULT': {
        'CACHE': not DEBUG,
        'BUNDLE_DIR_NAME': 'bundles/',
        'STATS_FILE': os.path.join(BASE_DIR, 'webpack-stats.json'),
        'POLL_INTERVAL': 0.1,
        'TIMEOUT': None,
        'IGNORE': [
            r'.+\.hot-update\.+',
            r'.+\.js\.map'
        ]