acceptance.py 2.84 KB
Newer Older
1
"""
Calen Pennington committed
2
This config file extends the test environment configuration
3 4
so that we can run the lettuce acceptance tests.
"""
5 6 7 8 9

# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=W0401, W0614

10
from .test import *
11
from lms.envs.sauce import *
12 13 14 15 16

# You need to start the server in debug mode,
# otherwise the browser will not render the pages correctly
DEBUG = True

17 18 19
# Disable warnings for acceptance tests, to make the logs readable
import logging
logging.disable(logging.ERROR)
20
import os
21
from random import choice, randint
22 23 24 25


def seed():
    return os.getppid()
26

27 28 29
MODULESTORE_OPTIONS = {
    'default_class': 'xmodule.raw_module.RawDescriptor',
    'host': 'localhost',
30
    'db': 'acceptance_xmodule',
31
    'collection': 'acceptance_modulestore_%s' % seed(),
32
    'fs_root': TEST_ROOT / "data",
33
    'render_template': 'mitxmako.shortcuts.render_to_string',
34 35 36 37
}

MODULESTORE = {
    'default': {
38
        'ENGINE': 'xmodule.modulestore.draft.DraftModuleStore',
39 40 41 42 43 44 45
        'OPTIONS': MODULESTORE_OPTIONS
    },
    'direct': {
        'ENGINE': 'xmodule.modulestore.mongo.MongoModuleStore',
        'OPTIONS': MODULESTORE_OPTIONS
    },
    'draft': {
46
        'ENGINE': 'xmodule.modulestore.draft.DraftModuleStore',
47 48 49
        'OPTIONS': MODULESTORE_OPTIONS
    }
}
50 51 52 53 54

CONTENTSTORE = {
    'ENGINE': 'xmodule.contentstore.mongo.MongoContentStore',
    'OPTIONS': {
        'host': 'localhost',
55
        'db': 'acceptance_xcontent_%s' % seed(),
56 57 58 59 60 61 62 63 64
    },
    # allow for additional options that can be keyed on a name, e.g. 'trashcan'
    'ADDITIONAL_OPTIONS': {
        'trashcan': {
            'bucket': 'trash_fs'
        }
    }
}

Calen Pennington committed
65
# Set this up so that rake lms[acceptance] and running the
66 67 68 69 70
# harvest command both use the same (test) database
# which they can flush without messing up your dev db
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
71 72
        'NAME': TEST_ROOT / "db" / "test_edx.db",
        'TEST_NAME': TEST_ROOT / "db" / "test_edx.db"
73 74 75
    }
}

76 77 78
# Use the auto_auth workflow for creating users and logging them in
MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True

JonahStanley committed
79 80 81 82 83
# HACK
# Setting this flag to false causes imports to not load correctly in the lettuce python files
# We do not yet understand why this occurs. Setting this to true is a stopgap measure
USE_I18N = True

84 85 86
# Include the lettuce app for acceptance testing, including the 'harvest' django-admin command
INSTALLED_APPS += ('lettuce.django',)
LETTUCE_APPS = ('contentstore',)
87
LETTUCE_SERVER_PORT = choice(PORTS) if SAUCE.get('SAUCE_ENABLED') else randint(1024, 65535)
88
LETTUCE_BROWSER = os.environ.get('LETTUCE_BROWSER', 'chrome')
89 90 91 92 93 94 95

#####################################################################
# Lastly, see if the developer has any local overrides.
try:
    from .private import *      # pylint: disable=F0401
except ImportError:
    pass