2012-07-21 13:56:04 +00:00
|
|
|
import os
|
2013-01-30 20:48:15 +00:00
|
|
|
import uuid
|
2013-07-27 11:46:18 +00:00
|
|
|
import django
|
|
|
|
|
|
2013-07-27 10:05:39 +00:00
|
|
|
from configurations import Configuration, pristinemethod
|
2014-04-17 14:23:36 +00:00
|
|
|
from configurations.values import BooleanValue
|
2012-07-21 13:56:04 +00:00
|
|
|
|
|
|
|
|
|
2013-07-27 10:05:39 +00:00
|
|
|
class Test(Configuration):
|
2017-09-29 16:10:18 +00:00
|
|
|
BASE_DIR = os.path.abspath(
|
|
|
|
|
os.path.join(os.path.dirname(
|
|
|
|
|
os.path.abspath(__file__)), os.pardir))
|
2014-04-17 14:23:36 +00:00
|
|
|
|
|
|
|
|
ENV_LOADED = BooleanValue(False)
|
|
|
|
|
|
2013-04-26 07:01:59 +00:00
|
|
|
DEBUG = True
|
|
|
|
|
|
2012-07-21 13:56:04 +00:00
|
|
|
SITE_ID = 1
|
|
|
|
|
|
2013-01-30 20:48:15 +00:00
|
|
|
SECRET_KEY = str(uuid.uuid4())
|
|
|
|
|
|
2012-07-21 13:56:04 +00:00
|
|
|
DATABASES = {
|
|
|
|
|
'default': {
|
|
|
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
|
|
|
'NAME': os.path.join(os.path.dirname(__file__), 'test.db'),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
INSTALLED_APPS = [
|
|
|
|
|
'django.contrib.sessions',
|
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
|
'django.contrib.sites',
|
|
|
|
|
'django.contrib.auth',
|
2013-09-09 09:02:43 +00:00
|
|
|
'tests',
|
2012-07-21 13:56:04 +00:00
|
|
|
]
|
|
|
|
|
|
2013-09-09 09:02:43 +00:00
|
|
|
ROOT_URLCONF = 'tests.urls'
|
2012-07-21 13:56:04 +00:00
|
|
|
|
2015-02-13 15:43:55 +00:00
|
|
|
if django.VERSION[:2] < (1, 6):
|
|
|
|
|
TEST_RUNNER = 'discover_runner.DiscoverRunner'
|
|
|
|
|
|
2017-09-29 16:10:18 +00:00
|
|
|
@property
|
|
|
|
|
def ALLOWED_HOSTS(self):
|
|
|
|
|
allowed_hosts = super(Test, self).ALLOWED_HOSTS[:]
|
|
|
|
|
allowed_hosts.append('base')
|
|
|
|
|
return allowed_hosts
|
2013-05-15 08:57:30 +00:00
|
|
|
|
2013-04-26 07:01:59 +00:00
|
|
|
ATTRIBUTE_SETTING = True
|
2012-07-21 13:56:04 +00:00
|
|
|
|
2013-04-26 07:01:59 +00:00
|
|
|
_PRIVATE_SETTING = 'ryan'
|
2012-07-21 13:56:04 +00:00
|
|
|
|
|
|
|
|
@property
|
2013-04-26 07:01:59 +00:00
|
|
|
def PROPERTY_SETTING(self):
|
2012-07-21 13:56:04 +00:00
|
|
|
return 1
|
|
|
|
|
|
2013-04-26 07:01:59 +00:00
|
|
|
def METHOD_SETTING(self):
|
|
|
|
|
return 2
|
2012-07-21 13:56:04 +00:00
|
|
|
|
2017-09-29 16:10:18 +00:00
|
|
|
LAMBDA_SETTING = lambda self: 3 # noqa: E731
|
2013-04-26 07:02:26 +00:00
|
|
|
|
2013-05-15 08:59:02 +00:00
|
|
|
PRISTINE_LAMBDA_SETTING = pristinemethod(lambda: 4)
|
2013-04-30 15:11:29 +00:00
|
|
|
|
2013-05-15 08:59:02 +00:00
|
|
|
@pristinemethod
|
2013-04-30 15:11:29 +00:00
|
|
|
def PRISTINE_FUNCTION_SETTING():
|
|
|
|
|
return 5
|
|
|
|
|
|
2013-05-15 08:57:30 +00:00
|
|
|
@classmethod
|
2013-05-15 09:32:57 +00:00
|
|
|
def pre_setup(cls):
|
|
|
|
|
cls.PRE_SETUP_TEST_SETTING = 6
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def post_setup(cls):
|
|
|
|
|
cls.POST_SETUP_TEST_SETTING = 7
|