Пример #1
0
def test_env_list_removes_whitespace(monkeypatch):
    """
    Test that extra whitespace is removed from list values.
    """
    monkeypatch.setenv('TEST_LIST_ENV_VARIABLE', 'a, b, c')

    actual = env_list('TEST_LIST_ENV_VARIABLE')
    assert actual == ['a', 'b', 'c']
Пример #2
0
def test_env_list_removes_whitespace(monkeypatch):
    """
    Test that extra whitespace is removed from list values.
    """
    monkeypatch.setenv('TEST_LIST_ENV_VARIABLE', 'a, b, c')

    actual = env_list('TEST_LIST_ENV_VARIABLE')
    assert actual == ['a', 'b', 'c']
Пример #3
0
def test_env_list_with_empty_list(monkeypatch):
    """
    Test that when the environment variable is missing and a default is
    provided, the default is used.
    """
    monkeypatch.setenv('TEST_LIST_ENV_VARIABLE', '')

    actual = env_list('TEST_LIST_ENV_VARIABLE')
    assert actual == []
Пример #4
0
def test_env_list_with_custom_separator(monkeypatch):
    """
    Test that when the environment variable is missing and a default is
    provided, the default is retured.
    """
    monkeypatch.setenv('TEST_LIST_ENV_VARIABLE', 'a:b:c')

    actual = env_list('TEST_LIST_ENV_VARIABLE', separator=':')
    assert actual == ['a', 'b', 'c']
Пример #5
0
def test_env_list_with_custom_separator(monkeypatch):
    """
    Test that when the environment variable is missing and a default is
    provided, the default is retured.
    """
    monkeypatch.setenv('TEST_LIST_ENV_VARIABLE', 'a:b:c')

    actual = env_list('TEST_LIST_ENV_VARIABLE', separator=':')
    assert actual == ['a', 'b', 'c']
Пример #6
0
def test_env_list_with_empty_list(monkeypatch):
    """
    Test that when the environment variable is missing and a default is
    provided, the default is used.
    """
    monkeypatch.setenv('TEST_LIST_ENV_VARIABLE', '')

    actual = env_list('TEST_LIST_ENV_VARIABLE')
    assert actual == []
Пример #7
0
def test_env_list_with_stock_usage(monkeypatch):
    """
    Test that when the environment variable is present that is is split on
    commas (by default) and returned as a list.
    """
    monkeypatch.setenv('TEST_LIST_ENV_VARIABLE', 'a,b,c')

    actual = env_list('TEST_LIST_ENV_VARIABLE')
    assert actual == ['a', 'b', 'c']
Пример #8
0
def test_env_list_with_stock_usage(monkeypatch):
    """
    Test that when the environment variable is present that is is split on
    commas (by default) and returned as a list.
    """
    monkeypatch.setenv('TEST_LIST_ENV_VARIABLE', 'a,b,c')

    actual = env_list('TEST_LIST_ENV_VARIABLE')
    assert actual == ['a', 'b', 'c']
Пример #9
0
def test_env_list_with_default_value():
    """
    Test that when the environment variable is missing and a default is
    provided, the default is used.
    """
    # sanity check
    assert 'TEST_LIST_ENV_VARIABLE' not in os.environ

    actual = env_list('TEST_LIST_ENV_VARIABLE', default='a,b,c')
    assert actual == ['a', 'b', 'c']
Пример #10
0
def test_env_list_with_default_value():
    """
    Test that when the environment variable is missing and a default is
    provided, the default is used.
    """
    # sanity check
    assert 'TEST_LIST_ENV_VARIABLE' not in os.environ

    actual = env_list('TEST_LIST_ENV_VARIABLE', default='a,b,c')
    assert actual == ['a', 'b', 'c']
Пример #11
0
def test_env_list_with_required_raises_when_not_present():
    # sanity check
    assert 'TEST_LIST_ENV_VARIABLE' not in os.environ

    with pytest.raises(KeyError):
        env_list('TEST_LIST_ENV_VARIABLE', required=True)
Пример #12
0
# 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

ALLOWED_HOSTS = excavator.env_list('DJANGO_ALLOWED_HOSTS', required=not DEBUG)

# Application definition

INSTALLED_APPS = (
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'django.contrib.humanize',

    # third party
    'pipeline',
    'bootstrap3',
    'storages',
    'raven.contrib.django.raven_compat',

    # core app
Пример #13
0
import excavator

from settings import *


PACKAGE_NAME_FILEBROWSER = "filebrowser_safe"
PACKAGE_NAME_GRAPPELLI = "grappelli_safe"
GRAPPELLI_INSTALLED = True

#INSTALLED_APPS += excavator.env_list('EXTRA_INSTALLED_APPS', required=True)
INSTALLED_APPS += [
    i for i in excavator.env_list('EXTRA_INSTALLED_APPS', required=True) if i not in INSTALLED_APPS
]


TEMPLATE_CONTEXT_PROCESSORS += (
    "mezzanine.conf.context_processors.settings",
    "mezzanine.pages.context_processors.page",
)
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 = []

REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': ]
        # Fill me in
    ),
Пример #15
0
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',
    # local
    'bughouse',
Пример #16
0
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',
)

# Allowed Hosts
# https://docs.djangoproject.com/en/1.7/ref/settings/#allowed-hosts
ALLOWED_HOSTS = excavator.env_list('DJANGO_ALLOWED_HOSTS', required=not DEBUG)

# Application definition
INSTALLED_APPS = [
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'django.contrib.humanize',
    # local project
    'volunteer.core',
    # local apps
    'volunteer.apps.events',
    'volunteer.apps.departments',
Пример #17
0
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',
    'django.contrib.messages.context_processors.messages',
    'django.core.context_processors.request',
    '{{ cookiecutter.app_name }}.apps.core.context_processors.rollbar',
)

ALLOWED_HOSTS = excavator.env_list('DJANGO_ALLOWED_HOSTS', required=not DEBUG)

# Application definition

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.admin',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    # third party
    'rest_framework',
    'django-pipeline',
    's3_folder_storage',
Пример #18
0
def test_env_list_with_required_and_default_is_error():
    with pytest.raises(ValueError):
        env_list('TEST_LIST_ENV_VARIABLE', required=True, default='a,b,c')
Пример #19
0
def test_env_list_with_required_raises_when_not_present():
    # sanity check
    assert 'TEST_LIST_ENV_VARIABLE' not in os.environ

    with pytest.raises(KeyError):
        env_list('TEST_LIST_ENV_VARIABLE', required=True)
Пример #20
0
import excavator

from settings import *

PACKAGE_NAME_FILEBROWSER = "filebrowser_safe"
PACKAGE_NAME_GRAPPELLI = "grappelli_safe"
GRAPPELLI_INSTALLED = True

#INSTALLED_APPS += excavator.env_list('EXTRA_INSTALLED_APPS', required=True)
INSTALLED_APPS += [
    i for i in excavator.env_list('EXTRA_INSTALLED_APPS', required=True)
    if i not in INSTALLED_APPS
]

TEMPLATE_CONTEXT_PROCESSORS += (
    "mezzanine.conf.context_processors.settings",
    "mezzanine.pages.context_processors.page",
)
Пример #21
0
def test_env_list_with_required_and_default_is_error():
    with pytest.raises(ValueError):
        env_list('TEST_LIST_ENV_VARIABLE', required=True, default='a,b,c')
Пример #22
0
)


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',
    '{{ cookiecutter.app_name }}.apps.core.context_processors.rollbar',
)

ALLOWED_HOSTS = excavator.env_list('DJANGO_ALLOWED_HOSTS', required=not DEBUG)


# Application definition

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.admin',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    # third party
    'rest_framework',
    'django-pipeline',
Пример #23
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',
    # local
    'bughouse',
    # 3rd party