selenium_test.py 3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
# Copyright 2014 Budapest University of Technology and Economics (BME IK)
#
# This file is part of CIRCLE Cloud.
#
# CIRCLE is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# CIRCLE is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with CIRCLE.  If not, see <http://www.gnu.org/licenses/>.
17

18 19
import os

20
from .base import *  # flake8:noqa
21 22


23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
# fix https://github.com/django-nose/django-nose/issues/197
# AttributeError: 'module' object has no attribute 'commit_unless_managed'
# TypeError: _skip_create_test_db() got an unexpected keyword argument 'keepdb'

from django.db import transaction
from django_nose import runner


def _skip_create_test_db(self, verbosity=1, autoclobber=False, serialize=True,
                         keepdb=True):
    return old_skip_create_test_db(
        self, verbosity=verbosity, autoclobber=autoclobber,
        serialize=serialize)


setattr(transaction, "commit_unless_managed", lambda using: using)
old_skip_create_test_db = runner._skip_create_test_db
setattr(runner, "_skip_create_test_db", _skip_create_test_db)


Csók Tamás committed
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
os.environ['REUSE_DB'] = "1"
os.environ['DJANGO_TEST_DB_NAME'] = "circle"
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.' +
        get_env_variable('DJANG_DB_TYPE', 'postgresql_psycopg2'),
        'NAME':  get_env_variable('DJANGO_DB_NAME', 'circle'),
        'TEST_NAME': get_env_variable('DJANGO_TEST_DB_NAME', 'circle'),
        'USER':  get_env_variable('DJANGO_DB_USER', 'circle'),
        'PASSWORD':  get_env_variable('DJANGO_DB_PASSWORD'),
        'HOST': get_env_variable('DJANGO_DB_HOST', ''),
        'PORT': get_env_variable('DJANGO_DB_PORT', ''),
    }
}
SOUTH_TESTS_MIGRATE = False

INSTALLED_APPS += (
60 61 62
    'acl.tests',
    'django_nose',
    'django_jenkins',
Csók Tamás committed
63 64
)
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
65

66 67

path_to_selenium_test = os.path.join(SITE_ROOT, "dashboard/tests/selenium")
68 69
NOSE_ARGS = ['--stop', '--with-doctest', '--with-selenium-driver',
             '--selenium-driver=firefox', '-w%s' % path_to_selenium_test]
Csók Tamás committed
70 71 72 73

PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher']

CACHES = {
74 75 76
    'default': {
        'BACKEND': 'django.core.cache.backends.dummy.DummyCache'
    }
Csók Tamás committed
77 78 79 80 81 82 83 84 85 86 87
}

LOGGING['loggers']['djangosaml2'] = {'handlers': ['console'],
                                     'level': 'CRITICAL'}

level = environ.get('LOGLEVEL', 'CRITICAL')
LOGGING['handlers']['console'] = {'level': level,
                                  'class': 'logging.StreamHandler',
                                  'formatter': 'simple'}
for i in LOCAL_APPS:
        LOGGING['loggers'][i] = {'handlers': ['console'], 'level': level}