bok_choy.py 4.41 KB
Newer Older
1
"""
2
Settings for Bok Choy tests that are used when running Studio.
3 4 5

Bok Choy uses two different settings files:
1. test_static_optimized is used when invoking collectstatic
6
2. bok_choy is used when running the tests
7 8 9 10

Note: it isn't possible to have a single settings file, because Django doesn't
support both generating static assets to a directory and also serving static
from the same directory.
11
"""
12 13

import os
14
from path import Path as path
15 16 17 18 19 20 21 22 23


########################## Prod-like settings ###################################
# These should be as close as possible to the settings we use in production.
# As in prod, we read in environment and auth variables from JSON files.
# Unlike in prod, we use the JSON files stored in this repo.
# This is a convenience for ensuring (a) that we can consistently find the files
# and (b) that the files are the same in Jenkins as in local dev.
os.environ['SERVICE_VARIANT'] = 'bok_choy'
24
os.environ['CONFIG_ROOT'] = path(__file__).abspath().dirname()
25

26
from .aws import *  # pylint: disable=wildcard-import, unused-wildcard-import
27 28 29

######################### Testing overrides ####################################

Will Daly committed
30
# Needed for the reset database management command
31 32 33
INSTALLED_APPS += ('django_extensions',)

# Redirect to the test_root folder within the repo
34
TEST_ROOT = REPO_ROOT / "test_root"
35 36
GITHUB_REPO_ROOT = (TEST_ROOT / "data").abspath()
LOG_DIR = (TEST_ROOT / "log").abspath()
37
DATA_DIR = TEST_ROOT / "data"
38

39 40 41 42
# Configure modulestore to use the test folder within the repo
update_module_store_settings(
    MODULESTORE,
    module_store_options={
43
        'fs_root': (TEST_ROOT / "data").abspath(),
44 45 46 47
    },
    xml_store_options={
        'data_dir': (TEST_ROOT / "data").abspath(),
    },
48
    default_store=os.environ.get('DEFAULT_STORE', 'draft'),
49
)
50

51 52 53 54 55 56 57 58 59
############################ STATIC FILES #############################

# Enable debug so that static assets are served by Django
DEBUG = True

# Serve static files at /static directly from the staticfiles directory under test root
# Note: optimized files for testing are generated with settings from test_static_optimized
STATIC_URL = "/static/"
STATICFILES_FINDERS = (
60
    'django.contrib.staticfiles.finders.FileSystemFinder',
61 62
)
STATICFILES_DIRS = (
63
    (TEST_ROOT / "staticfiles" / "cms").abspath(),
64
)
65 66 67 68

# Silence noisy logs
import logging
LOG_OVERRIDES = [
69 70
    ('track.middleware', logging.CRITICAL),
    ('edx.discussion', logging.CRITICAL),
71 72 73 74
]
for log_name, log_level in LOG_OVERRIDES:
    logging.getLogger(log_name).setLevel(log_level)

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

78 79 80 81 82 83
# Enable milestones app
FEATURES['MILESTONES_APP'] = True

# Enable pre-requisite course
FEATURES['ENABLE_PREREQUISITE_COURSES'] = True

cahrens committed
84 85 86
# Enable student notes
FEATURES['ENABLE_EDXNOTES'] = True

87 88 89
# Enable teams feature
FEATURES['ENABLE_TEAMS'] = True

90 91 92
# Enable custom content licensing
FEATURES['LICENSING'] = True

Alexander Kryklia committed
93 94 95
FEATURES['ENABLE_MOBILE_REST_API'] = True  # Enable video bumper in Studio
FEATURES['ENABLE_VIDEO_BUMPER'] = True  # Enable video bumper in Studio settings

96 97 98
# Enable partner support link in Studio footer
FEATURES['PARTNER_SUPPORT_EMAIL'] = 'partner-support@example.com'

99 100 101
# Disable some block types to test block deprecation logic
DEPRECATED_BLOCK_TYPES = ['poll', 'survey']

102 103 104
########################### Entrance Exams #################################
FEATURES['ENTRANCE_EXAMS'] = True

105
FEATURES['ENABLE_SPECIAL_EXAMS'] = True
106

107 108
# Point the URL used to test YouTube availability to our stub YouTube server
YOUTUBE_PORT = 9080
109 110
YOUTUBE['API'] = "http://127.0.0.1:{0}/get_youtube_api/".format(YOUTUBE_PORT)
YOUTUBE['METADATA_URL'] = "http://127.0.0.1:{0}/test_youtube/".format(YOUTUBE_PORT)
111
YOUTUBE['TEXT_API']['url'] = "127.0.0.1:{0}/test_transcripts_youtube/".format(YOUTUBE_PORT)
112

113
FEATURES['ENABLE_COURSEWARE_INDEX'] = True
114
FEATURES['ENABLE_LIBRARY_INDEX'] = True
115 116

FEATURES['ORGANIZATIONS_APP'] = True
117 118 119
SEARCH_ENGINE = "search.tests.mock_search_engine.MockSearchEngine"
# Path at which to store the mock index
MOCK_SEARCH_BACKING_FILE = (
120
    TEST_ROOT / "index_file.dat"
121 122
).abspath()

123 124 125 126
# Generate a random UUID so that different runs of acceptance tests don't break each other
import uuid
SECRET_KEY = uuid.uuid4().hex

127 128 129
#####################################################################
# Lastly, see if the developer has any local overrides.
try:
130
    from .private import *      # pylint: disable=import-error
131 132
except ImportError:
    pass