Exemplo n.º 1
0
def test_get_bool():
    """
    get_bool should get the bool from the environment variable, or raise an exception if it's not parseable as a bool
    """
    with patch('micromasters.envs.os', environ=FAKE_ENVIRONS):
        assert get_bool('true', 1234) is True
        assert get_bool('false', 1234) is False

        for key, value in FAKE_ENVIRONS.items():
            if key not in ('true', 'false'):
                with pytest.raises(EnvironmentVariableParseException) as ex:
                    get_bool(key, 1234)
                assert ex.value.args[0] == 'Expected value in {key}={value} to be a boolean'.format(
                    key=key,
                    value=value,
                )

        assert get_int('missing', 'default') == 'default'
Exemplo n.º 2
0
def test_get_bool():
    """
    get_bool should get the bool from the environment variable, or raise an exception if it's not parseable as a bool
    """
    with patch('micromasters.envs.os', environ=FAKE_ENVIRONS):
        assert get_bool('true', 1234) is True
        assert get_bool('false', 1234) is False

        for key, value in FAKE_ENVIRONS.items():
            if key not in ('true', 'false'):
                with pytest.raises(EnvironmentVariableParseException) as ex:
                    get_bool(key, 1234)
                assert ex.value.args[
                    0] == 'Expected value in {key}={value} to be a boolean'.format(
                        key=key,
                        value=value,
                    )

        assert get_int('missing', 'default') == 'default'
Exemplo n.º 3
0
    dsn=SENTRY_DSN, environment=ENVIRONMENT, version=VERSION, log_level=SENTRY_LOG_LEVEL
)

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
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': {
Exemplo n.º 4
0
VERSION = "0.133.1"


BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
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': {