Example #1
0
def test_env_bool_when_missing_and_required_is_error():
    """
    Test that when the env variable is not set and is required, it raises an
    error.
    """
    # sanity check
    assert 'TEST_BOOLEAN_ENV_VARIABLE' not in os.environ

    with pytest.raises(KeyError):
        env_bool('TEST_BOOLEAN_ENV_VARIABLE', required=True)
Example #2
0
def test_env_bool_when_missing_and_required_is_error():
    """
    Test that when the env variable is not set and is required, it raises an
    error.
    """
    # sanity check
    assert 'TEST_BOOLEAN_ENV_VARIABLE' not in os.environ

    with pytest.raises(KeyError):
        env_bool('TEST_BOOLEAN_ENV_VARIABLE', required=True)
Example #3
0
def test_env_bool_not_required_with_no_default(monkeypatch, env_value, expected):
    """
    Test that when the environment variable is present that it is parsed to a boolean.
    """
    monkeypatch.setenv('TEST_BOOLEAN_ENV_VARIABLE', env_value)

    actual = env_bool('TEST_BOOLEAN_ENV_VARIABLE')
    assert actual is expected
Example #4
0
def test_env_bool_when_missing_and_default_provided(default, expected):
    """
    Test that when the env variable is not set and a default is provided, the
    default is used.
    """
    assert 'TEST_BOOLEAN_ENV_VARIABLE' not in os.environ

    actual = env_bool('TEST_BOOLEAN_ENV_VARIABLE', default=default)
    assert actual is expected
Example #5
0
def test_env_bool_not_required_with_no_default(monkeypatch, env_value,
                                               expected):
    """
    Test that when the environment variable is present that it is parsed to a boolean.
    """
    monkeypatch.setenv('TEST_BOOLEAN_ENV_VARIABLE', env_value)

    actual = env_bool('TEST_BOOLEAN_ENV_VARIABLE')
    assert actual is expected
Example #6
0
def test_env_bool_when_missing_and_default_provided(default, expected):
    """
    Test that when the env variable is not set and a default is provided, the
    default is used.
    """
    assert 'TEST_BOOLEAN_ENV_VARIABLE' not in os.environ

    actual = env_bool('TEST_BOOLEAN_ENV_VARIABLE', default=default)
    assert actual is expected
Example #7
0
def test_env_bool_not_required_and_not_set():
    """
    Test that when the env variable is not set and not required it returns
    `None`.
    """
    # sanity check
    assert 'TEST_BOOLEAN_ENV_VARIABLE' not in os.environ

    actual = env_bool('TEST_BOOLEAN_ENV_VARIABLE')
    assert actual is None
Example #8
0
def test_env_bool_not_required_and_not_set():
    """
    Test that when the env variable is not set and not required it returns
    `None`.
    """
    # sanity check
    assert 'TEST_BOOLEAN_ENV_VARIABLE' not in os.environ

    actual = env_bool('TEST_BOOLEAN_ENV_VARIABLE')
    assert actual is None
Example #9
0
    "compressor",
    "argonauts",
    # tests modules
    "modeltests.core_tests",
    "modeltests.proxy_gfk",
    "regressiontests.utilstests",
    # tests/modeltests/core_tests/models::ReviewedVersionedPage has an fk to
    # `review_queue.ReviewedVersionTracker`.  Until that test is moved into a
    # contrib test suite, that app neeeds to be installed.
    "widgy.contrib.review_queue",
]

if django.VERSION < (1, 7):
    INSTALLED_APPS.append("south")

SOUTH_TESTS_MIGRATE = excavator.env_bool('SOUTH_TESTS_MIGRATE', default=False)

try:
    import easy_thumbnails
except ImportError:
    pass
else:
    if easy_thumbnails.VERSION >= 2:
        SOUTH_MIGRATION_MODULES = {
            'easy_thumbnails': 'easy_thumbnails.south_migrations',
        }

URLCONF_INCLUDE_CHOICES = tuple()
TEST_RUNNER = 'django.test.simple.DjangoTestSuiteRunner'

MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
Example #10
0
import os
import excavator
import dj_database_url
import django_cache_url

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = excavator.env_string('DJANGO_SECRET_KEY', required=True)

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = excavator.env_bool('DJANGO_DEBUG', default=True)

TEMPLATE_DEBUG = DEBUG

# Template Locations
# https://docs.djangoproject.com/en/1.7/ref/settings/#template-dirs
TEMPLATE_DIRS = (os.path.join(BASE_DIR, '{{ cookiecutter.app_name }}',
                              'templates'), )

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.contrib.auth.context_processors.auth',
    'django.core.context_processors.debug',
    'django.core.context_processors.i18n',
    'django.core.context_processors.media',
    'django.core.context_processors.static',
    'django.core.context_processors.tz',
Example #11
0
import os
import excavator
from dj_database_url import config as dj_config


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


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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = excavator.env_string('DJANGO_SECRET_KEY', required=True)

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = excavator.env_bool('DJANGO_DEBUG', required=True)

ALLOWED_HOSTS = excavator.env_list("DJANGO_ALLOWED_HOSTS", required=True)

TEMPLATE_DEBUG = DEBUG


# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
Example #12
0
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = excavator.env_string('DJANGO_SECRET_KEY', required=True)


ADMINS = (
    ('Piper', '*****@*****.**'),
)

DEFAULT_FROM_EMAIL = excavator.env_string(
    'DJANGO_DEFAULT_FROM_EMAIL', default='*****@*****.**',
)


# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = excavator.env_bool('DJANGO_DEBUG', default=False)

TEMPLATE_DEBUG = DEBUG

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.contrib.auth.context_processors.auth',
    'django.core.context_processors.debug',
    'django.core.context_processors.i18n',
    'django.core.context_processors.media',
    'django.core.context_processors.static',
    'django.core.context_processors.tz',
    'django.contrib.messages.context_processors.messages',
    'django.core.context_processors.request',
    'volunteer.core.context_processors.rollbar',
    'volunteer.apps.shifts.context_processors.shift_stats',
)
Example #13
0
def test_that_required_and_default_are_mutually_exclusive():
    """
    Test that when `required` and `default` are both set, raises a ValueError.
    """
    with pytest.raises(ValueError):
        env_bool('TEST_BOOLEAN_ENV_VARIABLE', required=True, default=True)
Example #14
0
import excavator
import dj_database_url
import django_cache_url

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(__file__))


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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = excavator.env_string('DJANGO_SECRET_KEY', required=True)

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = excavator.env_bool('DJANGO_DEBUG', default=True)

TEMPLATE_DEBUG = DEBUG

# Template Locations
# https://docs.djangoproject.com/en/1.7/ref/settings/#template-dirs
TEMPLATE_DIRS = (
    os.path.join(BASE_DIR, 'mozy', 'templates'),
)


TEMPLATE_CONTEXT_PROCESSORS = (
    'django.contrib.auth.context_processors.auth',
    'django.core.context_processors.debug',
    'django.core.context_processors.i18n',
    'django.core.context_processors.media',
Example #15
0
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
import excavator
from dj_database_url import config as dj_config

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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = excavator.env_string('DJANGO_SECRET_KEY', required=True)

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = excavator.env_bool('DJANGO_DEBUG', required=True)

TEMPLATE_DEBUG = DEBUG

ALLOWED_HOSTS = []

# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # local
Example #16
0
def test_that_required_and_default_are_mutually_exclusive():
    """
    Test that when `required` and `default` are both set, raises a ValueError.
    """
    with pytest.raises(ValueError):
        env_bool('TEST_BOOLEAN_ENV_VARIABLE', required=True, default=True)
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
import excavator
import dj_database_url
import django_cache_url


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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = excavator.env_string('DJANGO_SECRET_KEY', required=True)

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = excavator.env_bool('DJANGO_DEBUG', default=False)

TEMPLATE_DEBUG = True

ALLOWED_HOSTS = excavator.env_list('DJANGO_ALLOWED_HOSTS', '')


# Application definition

INSTALLED_APPS = (
    'rest_framework',
    '{{ cookiecutter.app_name }}',
)

MIDDLEWARE_CLASSES = []
import excavator
import dj_database_url
import django_cache_url

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(__file__))


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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = excavator.env_string('DJANGO_SECRET_KEY', required=True)

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = excavator.env_bool('DJANGO_DEBUG', default=True)

TEMPLATE_DEBUG = DEBUG

# Template Locations
# https://docs.djangoproject.com/en/1.7/ref/settings/#template-dirs
TEMPLATE_DIRS = (
    os.path.join(BASE_DIR, '{{ cookiecutter.app_name }}', 'templates'),
)


TEMPLATE_CONTEXT_PROCESSORS = (
    'django.contrib.auth.context_processors.auth',
    'django.core.context_processors.debug',
    'django.core.context_processors.i18n',
    'django.core.context_processors.media',
Example #19
0
    "argonauts",
    # tests modules
    "modeltests.core_tests",
    "modeltests.proxy_gfk",
    "regressiontests.utilstests",
    # tests/modeltests/core_tests/models::ReviewedVersionedPage has an fk to
    # `review_queue.ReviewedVersionTracker`.  Until that test is moved into a
    # contrib test suite, that app neeeds to be installed.
    "widgy.contrib.review_queue",
]

if django.VERSION < (1, 7):
    INSTALLED_APPS.append("south")


SOUTH_TESTS_MIGRATE = excavator.env_bool('SOUTH_TESTS_MIGRATE', default=False)

try:
    import easy_thumbnails
except ImportError:
    pass
else:
    if easy_thumbnails.VERSION >= 2:
        SOUTH_MIGRATION_MODULES = {
            'easy_thumbnails': 'easy_thumbnails.south_migrations',
        }

URLCONF_INCLUDE_CHOICES = tuple()
TEST_RUNNER = 'django.test.simple.DjangoTestSuiteRunner'

MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'