acceptance.py 5.93 KB
Newer Older
1
"""
Calen Pennington committed
2
This config file extends the test environment configuration
3
so that we can run the lettuce acceptance tests.
4
"""
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 .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
# Output Django logs to a file
18
import logging
19 20
logging.basicConfig(filename=TEST_ROOT / "log" / "lms_acceptance.log", level=logging.ERROR)

21
import os
22
from random import choice, randint
23
import string
24

25

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

29
# Use the mongo store for acceptance tests
30
DOC_STORE_CONFIG = {
31
    'host': 'localhost',
32
    'db': 'acceptance_xmodule',
33
    'collection': 'acceptance_modulestore_%s' % seed(),
34 35
}

36
modulestore_options = {
37
    'default_class': 'xmodule.raw_module.RawDescriptor',
38
    'fs_root': TEST_ROOT / "data",
David Baumgold committed
39
    'render_template': 'edxmako.shortcuts.render_to_string',
40
}
41

42 43
MODULESTORE = {
    'default': {
44 45 46 47 48 49
        'ENGINE': 'xmodule.modulestore.mixed.MixedModuleStore',
        'OPTIONS': {
            'mappings': {},
            'stores': {
                'default': {
                    'ENGINE': 'xmodule.modulestore.mongo.MongoModuleStore',
50
                    'DOC_STORE_CONFIG': DOC_STORE_CONFIG,
51 52 53 54
                    'OPTIONS': modulestore_options
                }
            }
        }
55 56
    }
}
57

58 59
MODULESTORE['direct'] = MODULESTORE['default']

60 61
CONTENTSTORE = {
    'ENGINE': 'xmodule.contentstore.mongo.MongoContentStore',
62
    'DOC_STORE_CONFIG': {
63
        'host': 'localhost',
64
        'db': 'acceptance_xcontent_%s' % seed(),
65 66 67
    }
}

Calen Pennington committed
68
# Set this up so that rake lms[acceptance] and running the
69 70 71 72 73
# 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',
74 75
        'NAME': TEST_ROOT / "db" / "test_edx.db",
        'TEST_NAME': TEST_ROOT / "db" / "test_edx.db",
76
    }
77 78
}

79 80 81 82 83 84
TRACKING_BACKENDS.update({
    'mongo': {
        'ENGINE': 'track.backends.mongodb.MongoBackend'
    }
})

85 86 87 88 89 90 91

# Enable asset pipeline
# Our fork of django-pipeline uses `PIPELINE` instead of `PIPELINE_ENABLED`
# PipelineFinder is explained here: http://django-pipeline.readthedocs.org/en/1.1.24/storages.html
PIPELINE = True
STATICFILES_FINDERS += ('pipeline.finders.PipelineFinder', )

92
BULK_EMAIL_DEFAULT_FROM_EMAIL = "test@test.org"
93

94 95
# Forums are disabled in test.py to speed up unit tests, but we do not have
# per-test control for acceptance tests
96
FEATURES['ENABLE_DISCUSSION_SERVICE'] = True
97

98
# Use the auto_auth workflow for creating users and logging them in
99
FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True
100

101
# Enable fake payment processing page
102
FEATURES['ENABLE_PAYMENT_FAKE'] = True
103

104
# Enable email on the instructor dash
105 106
FEATURES['ENABLE_INSTRUCTOR_EMAIL'] = True
FEATURES['REQUIRE_COURSE_EMAIL_AUTH'] = False
107

108 109
# Don't actually send any requests to Software Secure for student identity
# verification.
110
FEATURES['AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'] = True
111

112 113 114 115 116 117 118 119 120 121 122 123 124 125
# Configure the payment processor to use the fake processing page
# Since both the fake payment page and the shoppingcart app are using
# the same settings, we can generate this randomly and guarantee
# that they are using the same secret.
RANDOM_SHARED_SECRET = ''.join(
    choice(string.letters + string.digits + string.punctuation)
    for x in range(250)
)

CC_PROCESSOR['CyberSource']['SHARED_SECRET'] = RANDOM_SHARED_SECRET
CC_PROCESSOR['CyberSource']['MERCHANT_ID'] = "edx"
CC_PROCESSOR['CyberSource']['SERIAL_NUMBER'] = "0123456789012345678901"
CC_PROCESSOR['CyberSource']['PURCHASE_ENDPOINT'] = "/shoppingcart/payment_fake"

126 127 128 129 130
# 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

131
FEATURES['ENABLE_FEEDBACK_SUBMISSION'] = True
JonahStanley committed
132 133
FEEDBACK_SUBMISSION_EMAIL = 'dummy@example.com'

134
# Include the lettuce app for acceptance testing, including the 'harvest' django-admin command
135
INSTALLED_APPS += ('lettuce.django',)
136 137 138 139 140 141 142 143 144
LETTUCE_APPS = ('courseware', 'instructor',)

# Lettuce appears to have a bug that causes it to search
# `instructor_task` when we specify the `instructor` app.
# This causes some pretty cryptic errors as lettuce tries
# to parse files in `instructor_task` as features.
# As a quick workaround, explicitly exclude the `instructor_task` app.
LETTUCE_AVOID_APPS = ('instructor_task',)

145
LETTUCE_BROWSER = os.environ.get('LETTUCE_BROWSER', 'chrome')
146

147 148 149 150 151 152 153 154
# Where to run: local, saucelabs, or grid
LETTUCE_SELENIUM_CLIENT = os.environ.get('LETTUCE_SELENIUM_CLIENT', 'local')

SELENIUM_GRID = {
    'URL': 'http://127.0.0.1:4444/wd/hub',
    'BROWSER': LETTUCE_BROWSER,
}

155
#####################################################################
156
# See if the developer has any local overrides.
157
try:
158
    from .private import *  # pylint: disable=F0401
159 160
except ImportError:
    pass
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193

# Because an override for where to run will affect which ports to use,
# set these up after the local overrides.
if LETTUCE_SELENIUM_CLIENT == 'saucelabs':
    LETTUCE_SERVER_PORT = choice(PORTS)
    PORTS.remove(LETTUCE_SERVER_PORT)
else:
    LETTUCE_SERVER_PORT = randint(1024, 65535)

# Set up XQueue information so that the lms will send
# requests to a mock XQueue server running locally
if LETTUCE_SELENIUM_CLIENT == 'saucelabs':
    XQUEUE_PORT = choice(PORTS)
    PORTS.remove(XQUEUE_PORT)
else:
    XQUEUE_PORT = randint(1024, 65535)

XQUEUE_INTERFACE = {
    "url": "http://127.0.0.1:%d" % XQUEUE_PORT,
    "django_auth": {
        "username": "lms",
        "password": "***REMOVED***"
    },
    "basic_auth": ('anant', 'agarwal'),
}

# Set up Video information so that the lms will send
# requests to a mock Youtube server running locally
if LETTUCE_SELENIUM_CLIENT == 'saucelabs':
    VIDEO_PORT = choice(PORTS)
    PORTS.remove(VIDEO_PORT)
else:
    VIDEO_PORT = randint(1024, 65535)