diff --git a/modoboa/test_settings.py b/modoboa/test_settings.py new file mode 100644 index 000000000..50752c90b --- /dev/null +++ b/modoboa/test_settings.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +import os + +# Database +# https://docs.djangoproject.com/en/1.6/ref/settings/#databases + +DB = os.environ.get('DB', 'POSTGRES') + +if DB == 'MYSQL': + DATABASES = { + + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'modoboa_test', + 'USER': 'modoboa', + 'PASSWORD': 'modoboa', + 'HOST': 'localhost', + 'PORT': '', + 'ATOMIC_REQUESTS': True, + + }, + + } +else: + DATABASES = { + + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': 'modoboa_test', + 'USER': 'postgres', + 'PASSWORD': '', + 'HOST': 'localhost', + 'PORT': '', + 'ATOMIC_REQUESTS': True, + + }, + + } diff --git a/test_project/test_project/settings.py b/test_project/test_project/settings.py index 8df3f5dd7..0927dd493 100644 --- a/test_project/test_project/settings.py +++ b/test_project/test_project/settings.py @@ -14,6 +14,7 @@ from logging.handlers import SysLogHandler from django.conf import global_settings +from modoboa.test_settings import * BASE_DIR = os.path.dirname(os.path.dirname(__file__)) @@ -91,40 +92,6 @@ ROOT_URLCONF = 'test_project.urls' WSGI_APPLICATION = 'test_project.wsgi.application' -# Database -# https://docs.djangoproject.com/en/1.6/ref/settings/#databases - -if os.environ.get('DB') == 'MYSQL': - DATABASES = { - - 'default': { - 'ENGINE': 'django.db.backends.mysql', - 'NAME': 'modoboa_test', - 'USER': 'modoboa', - 'PASSWORD': 'modoboa', - 'HOST': 'localhost', - 'PORT': '', - 'ATOMIC_REQUESTS': True, - - }, - - } -else: - DATABASES = { - - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'modoboa_test', - 'USER': 'postgres', - 'PASSWORD': '', - 'HOST': 'localhost', - 'PORT': '', - 'ATOMIC_REQUESTS': True, - - }, - - } - # Internationalization # https://docs.djangoproject.com/en/1.6/topics/i18n/ @@ -201,4 +168,3 @@ LOGGING = { } } } -