def test_should_use_media_folder_in_debug(self): env = default_env(__name__, 'foo.com', 'root@localhost', debug=True, test=False) base = os.path.abspath(env.settings.BASE_PATH) self.assertEqual('/media', env.settings.MEDIA_ROOT.replace(base, ''))
def test_should_not_load_debug_toolbar_if_not_in_debug_mode(self): env = default_env(__name__, 'foo.com', 'root@localhost', debug=False, debug_toolbar=True) self.assertNotIn('debug_toolbar.middleware.DebugToolbarMiddleware', env.settings.MIDDLEWARE_CLASSES)
def test_should_use_public_html_folder_in_production(self): env = default_env(__name__, 'foo.com', 'root@localhost', debug=False, test=False) base = os.path.abspath(os.path.join(env.settings.BASE_PATH, '..', '..')) self.assertEqual('/public_html/media', env.settings.MEDIA_ROOT.replace(base, ''))
def test_should_use_default_image_sizes(self): env = default_env(__name__, 'foo.com', 'root@localhost') self.assertEqual( { 'xx-small': 50, 'x-small': 160, 'small': 320, 'medium': 640, 'large': 900, 'x-large': 1200 }, env.settings.IMAGE_SIZES) self.assertEqual('x-large', env.settings.DEFAULT_IMAGE_SIZE)
def test_should_use_extra_large_image_sizes_if_argument_is_given(self): env = default_env(__name__, 'foo.com', 'root@localhost', high_res_images=True) self.assertEqual( { 'xx-small': 50, 'x-small': 160, 'small': 320, 'medium': 640, 'large': 900, 'x-large': 1200, 'xx-large': 1600, 'xxx-large': 2400, }, env.settings.IMAGE_SIZES) self.assertEqual('xxx-large', env.settings.DEFAULT_IMAGE_SIZE)
def test_should_load_ssl_if_argument_is_given(self): env = default_env(__name__, 'foo.com', 'root@localhost', ssl=True) self.assertIn('cubane.middleware.SSLResponseRedirectMiddleware', env.settings.MIDDLEWARE_CLASSES)
def test_should_not_load_ssl_by_default(self): env = default_env(__name__, 'foo.com', 'root@localhost') self.assertNotIn('cubane.middleware.SSLResponseRedirectMiddleware', env.settings.MIDDLEWARE_CLASSES)
def test_should_use_google_closure_compiler_in_production(self): env = default_env(__name__, 'foo.com', 'root@localhost', test=False) self.assertIn('closure-compiler', env.settings.MINIFY_CMD_JS)
def test_should_setup_site_admin_with_email(self): env = default_env(__name__, 'foo.com', 'root@localhost') self.assertEqual((('admin', 'root@localhost'), ), env.settings.ADMINS)
def test_should_use_older_but_fater_yui_compressor_in_test(self): env = default_env(__name__, 'foo.com', 'root@localhost', test=True) self.assertIn('yuicompressor', env.settings.MINIFY_CMD_JS)
def test_should_apply_specific_database_name_if_given(self): env = default_env(__name__, 'foo.com', 'root@localhost', db_name='bar') self.assertEqual('bar', env.settings.DATABASE_NAME)
def test_should_derive_database_name_from_domain_name_automatically(self): env = default_env(__name__, 'foo.com', 'root@localhost') self.assertEqual('foo_com', env.settings.DATABASE_NAME)
# coding=UTF-8 from __future__ import unicode_literals from cubane.settings import default_env import dj_database_url import os env = default_env(__name__, os.environ.get('DOMAIN_NAME', ''), os.environ.get('ADMIN_EMAIL', ''), csrf=True, ssl=False) # # Site # SECRET_KEY = os.environ.get('SECRET_KEY', '') ROOT_URLCONF = 'app.urls' # # Database # DATABASE_URL = os.environ.get('DATABASE_URL') if DATABASE_URL: DATABASES = {'default': dj_database_url.config(default=DATABASE_URL)} else: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': os.environ.get('POSTGRES_DB', ''), 'USER': os.environ.get('POSTGRES_USER', ''), 'PASSWORD': os.environ.get('POSTGRES_PASSWORD', ''),
# coding=UTF-8 from __future__ import unicode_literals from cubane.settings import default_env env = default_env( __name__, '$DOMAIN_NAME$', '$ADMIN_EMAIL$', csrf=True, ssl=False ) # # Site # SECRET_KEY = '$SECRET_KEY$' ROOT_URLCONF = '$TARGET_NAME$.urls' # # Apps # env.add_apps([ 'cubane', 'cubane.backend', 'cubane.backend.accounts', 'cubane.cms', 'cubane.media', 'cubane.medialoader', 'cubane.enquiry', 'cubane.dbmigrate',
# coding=UTF-8 from __future__ import unicode_literals from cubane.settings import default_env import math env = default_env(__name__, 'testapp.cubane.innershed.com', 'root@localhost', csrf=True) # # Test Runner # TEST_RUNNER = 'cubane.tests.runner.CubaneTestRunner' # # Site and Revision # SECRET_KEY = 'dsgdf7ymh(r9d2)_8z5s_&%rdq_77ln+k9^y(+j9c98pw(wu+6-afbldfgsdf' ROOT_URLCONF = 'cubane.testapp.urls' # # Middleware # MIDDLEWARE_CLASSES += () # # Template Context Processors # env.add_template_context_processors(['cubane.ishop.context_processors.shop']) #