コード例 #1
0
ファイル: test.py プロジェクト: digideskio/dj-paas-env
 def test_config_gondor(self):
     os.environ['GONDOR_DATABASE_URL'] = 'postgres://*****:*****@qwer:12345/rewq'
     conf = database.config()
     self.assertDictEqual(conf, {
         'ENGINE': 'django.db.backends.postgresql_psycopg2',
         'NAME': 'rewq',
         'USER': '******',
         'PASSWORD': '******',
         'HOST': 'qwer',
         'PORT': 12345
     })
コード例 #2
0
ファイル: test.py プロジェクト: digideskio/dj-paas-env
 def test_config_heroku_mysql(self):
     os.environ['CLEARDB_DATABASE_URL'] = 'mysql://*****:*****@qwer:12345/rewq'
     conf = database.config()
     self.assertDictEqual(conf, {
         'ENGINE': 'django.db.backends.mysql',
         'NAME': 'rewq',
         'USER': '******',
         'PASSWORD': '******',
         'HOST': 'qwer',
         'PORT': 12345
     })
コード例 #3
0
ファイル: test.py プロジェクト: digideskio/dj-paas-env
 def test_config_heroku_postgres(self):
     os.environ['HEROKU_POSTGRESQL_BLACK_URL'] = 'postgres://*****:*****@qwer:12345/rewq'
     conf = database.config()
     self.assertDictEqual(conf, {
         'ENGINE': 'django.db.backends.postgresql_psycopg2',
         'NAME': 'rewq',
         'USER': '******',
         'PASSWORD': '******',
         'HOST': 'qwer',
         'PORT': 12345
     })
コード例 #4
0
 def test_config_heroku_promoted(self):
     os.environ['DATABASE_URL'] = 'postgres://*****:*****@qwer:12345/rewq'
     conf = database.config()
     self.assertDictEqual(
         conf, {
             'ENGINE': 'django.db.backends.postgresql_psycopg2',
             'NAME': 'rewq',
             'USER': '******',
             'PASSWORD': '******',
             'HOST': 'qwer',
             'PORT': 12345
         })
コード例 #5
0
ファイル: test.py プロジェクト: digideskio/dj-paas-env
 def test_config_openshift_mysql(self):
     os.environ['OPENSHIFT_MYSQL_DB_URL'] = 'mysql://*****:*****@qwer:12345/rewq'
     os.environ['OPENSHIFT_APP_NAME'] = 'rewq'
     conf = database.config()
     self.assertDictEqual(conf, {
         'ENGINE': 'django.db.backends.mysql',
         'NAME': 'rewq',
         'USER': '******',
         'PASSWORD': '******',
         'HOST': 'qwer',
         'PORT': 12345
     })
コード例 #6
0
ファイル: test.py プロジェクト: digideskio/dj-paas-env
 def test_config_openshift_postgres(self):
     os.environ['OPENSHIFT_POSTGRESQL_DB_URL'] = 'postgresql://*****:*****@qwer:12345'
     os.environ['PGDATABASE'] = 'rewq'
     conf = database.config()
     self.assertDictEqual(conf, {
         'ENGINE': 'django.db.backends.postgresql_psycopg2',
         'NAME': 'rewq',
         'USER': '******',
         'PASSWORD': '******',
         'HOST': 'qwer',
         'PORT': 12345
     })
コード例 #7
0
 def test_config_heroku_mysql(self):
     os.environ[
         'CLEARDB_DATABASE_URL'] = 'mysql://*****:*****@qwer:12345/rewq'
     conf = database.config()
     self.assertDictEqual(
         conf, {
             'ENGINE': 'django.db.backends.mysql',
             'NAME': 'rewq',
             'USER': '******',
             'PASSWORD': '******',
             'HOST': 'qwer',
             'PORT': 12345
         })
コード例 #8
0
 def test_config_openshift_mysql(self):
     os.environ[
         'OPENSHIFT_MYSQL_DB_URL'] = 'mysql://*****:*****@qwer:12345/rewq'
     os.environ['OPENSHIFT_APP_NAME'] = 'rewq'
     conf = database.config()
     self.assertDictEqual(
         conf, {
             'ENGINE': 'django.db.backends.mysql',
             'NAME': 'rewq',
             'USER': '******',
             'PASSWORD': '******',
             'HOST': 'qwer',
             'PORT': 12345
         })
コード例 #9
0
 def test_config_openshift_postgres(self):
     os.environ[
         'OPENSHIFT_POSTGRESQL_DB_URL'] = 'postgresql://*****:*****@qwer:12345'
     os.environ['PGDATABASE'] = 'rewq'
     conf = database.config()
     self.assertDictEqual(
         conf, {
             'ENGINE': 'django.db.backends.postgresql_psycopg2',
             'NAME': 'rewq',
             'USER': '******',
             'PASSWORD': '******',
             'HOST': 'qwer',
             'PORT': 12345
         })
コード例 #10
0
 def test_config_engine(self, mock):
     os.environ['DATABASE_URL'] = 'postgres://*****:*****@qwer:12345/rewq'
     database.config(engine='xxxx')
     mock.assert_called_with('postgres://*****:*****@qwer:12345/rewq', 'xxxx')
コード例 #11
0
 def test_config_default(self, mock):
     database.config(default='bbbb')
     mock.assert_called_with('bbbb', None)
コード例 #12
0
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = '{{cookiecutter.project_name}}.urls'

WSGI_APPLICATION = '{{cookiecutter.project_name}}.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases

# Parse database configuration from environment
from dj_paas_env import database
DATABASES = {
    'default': database.config(default=database.sqlite_dev()),
}

# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True
コード例 #13
0
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = '{{cookiecutter.project_name}}.urls'

WSGI_APPLICATION = '{{cookiecutter.project_name}}.wsgi.application'

# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases

# Parse database configuration from environment
from dj_paas_env import database

DATABASES = {
    'default': database.config(default=database.sqlite_dev()),
}

# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True
コード例 #14
0
ファイル: test.py プロジェクト: digideskio/dj-paas-env
 def test_config_engine(self, mock):
     os.environ['DATABASE_URL'] = 'postgres://*****:*****@qwer:12345/rewq'
     database.config(engine='xxxx')
     mock.assert_called_with('postgres://*****:*****@qwer:12345/rewq', 'xxxx')
コード例 #15
0
ファイル: test.py プロジェクト: digideskio/dj-paas-env
 def test_config_default(self, mock):
     database.config(default='bbbb')
     mock.assert_called_with('bbbb', None)