def _pre_setup(self): # load the one xml course into the xml store update_module_store_settings( settings.MODULESTORE, mappings={"edX/toy/2012_Fall": ModuleStoreEnum.Type.xml}, xml_store_options={"data_dir": settings.COMMON_TEST_DATA_ROOT}, # where toy course lives ) super(XBlockGetParentTest, self)._pre_setup()
def _pre_setup(self): # load the one xml course into the xml store update_module_store_settings( settings.MODULESTORE, mappings={'edX/toy/2012_Fall': ModuleStoreEnum.Type.xml}, xml_store_options={ 'data_dir': settings.COMMON_TEST_DATA_ROOT # where toy course lives }, ) super(XBlockGetParentTest, self)._pre_setup()
# If we don't add these settings, then Django templates that can't # find pipelined assets will raise a ValueError. # http://stackoverflow.com/questions/12816941/unit-testing-with-django-pipeline STATICFILES_STORAGE = 'pipeline.storage.NonPackagingPipelineStorage' STATIC_URL = "/static/" BLOCK_STRUCTURES_SETTINGS['PRUNING_ACTIVE'] = True # Update module store settings per defaults for tests update_module_store_settings( MODULESTORE, module_store_options={ 'default_class': 'xmodule.raw_module.RawDescriptor', 'fs_root': TEST_ROOT / "data", }, doc_store_settings={ 'db': 'test_xmodule_{}'.format(THIS_UUID), 'host': MONGO_HOST, 'port': MONGO_PORT_NUM, 'collection': 'test_modulestore', }, ) CONTENTSTORE = { 'ENGINE': 'xmodule.contentstore.mongo.MongoContentStore', 'DOC_STORE_CONFIG': { 'host': MONGO_HOST, 'db': 'test_xcontent_{}'.format(THIS_UUID), 'port': MONGO_PORT_NUM, 'collection': 'dont_trip', },
DOC_STORE_CONFIG = config( "DOC_STORE_CONFIG", default={ "collection": "modulestore", "host": MONGODB_HOST, "port": MONGODB_PORT, "db": MONGODB_NAME, "user": MONGODB_USER, "password": MONGODB_PASSWORD, "ssl": MONGODB_SSL, }, formatter=json.loads, ) update_module_store_settings(MODULESTORE, doc_store_settings=DOC_STORE_CONFIG) MONGODB_LOG = config("MONGODB_LOG", default={}, formatter=json.loads) CONTENTSTORE = config( "CONTENTSTORE", default={ "DOC_STORE_CONFIG": DOC_STORE_CONFIG, "ENGINE": "xmodule.contentstore.mongo.MongoContentStore", }, formatter=json.loads, ) EMAIL_HOST_USER = config("EMAIL_HOST_USER", default="") # django default is '' EMAIL_HOST_PASSWORD = config("EMAIL_HOST_PASSWORD", default="") # django default is ''
def test_update_settings_error(self): mixed_setting = self.ALREADY_UPDATED_MIXED_CONFIG with self.assertRaises(Exception): update_module_store_settings(mixed_setting, default_store='non-existent store')
def test_update_settings(self, default_store): mixed_setting = self.ALREADY_UPDATED_MIXED_CONFIG update_module_store_settings(mixed_setting, default_store=default_store) self.assertEqual( get_mixed_stores(mixed_setting)[0]['NAME'], default_store)
# If we don't add these settings, then Django templates that can't # find pipelined assets will raise a ValueError. # http://stackoverflow.com/questions/12816941/unit-testing-with-django-pipeline STATICFILES_STORAGE = 'pipeline.storage.NonPackagingPipelineStorage' # Don't use compression during tests PIPELINE['JS_COMPRESSOR'] = None update_module_store_settings( MODULESTORE, module_store_options={ 'fs_root': TEST_ROOT / "data", }, xml_store_options={ 'data_dir': mkdtemp_clean(dir=TEST_ROOT), # never inadvertently load all the XML courses }, doc_store_settings={ 'host': MONGO_HOST, 'port': MONGO_PORT_NUM, 'db': 'test_xmodule_{}'.format(THIS_UUID), 'collection': 'test_modulestore', }, ) CONTENTSTORE = { 'ENGINE': 'xmodule.contentstore.mongo.MongoContentStore', 'DOC_STORE_CONFIG': { 'host': MONGO_HOST, 'db': 'test_xcontent_{}'.format(THIS_UUID), 'port': MONGO_PORT_NUM, }
def test_update_settings(self, default_store): mixed_setting = self.ALREADY_UPDATED_MIXED_CONFIG update_module_store_settings(mixed_setting, default_store=default_store) self.assertEqual(get_mixed_stores(mixed_setting)[0]['NAME'], default_store)
from .production import * # pylint: disable=wildcard-import, unused-wildcard-import, wrong-import-position ######################### Testing overrides #################################### # Redirect to the test_root folder within the repo TEST_ROOT = REPO_ROOT / "test_root" GITHUB_REPO_ROOT = (TEST_ROOT / "data").abspath() LOG_DIR = (TEST_ROOT / "log").abspath() DATA_DIR = TEST_ROOT / "data" # Configure modulestore to use the test folder within the repo update_module_store_settings( MODULESTORE, module_store_options={ 'fs_root': (TEST_ROOT / "data").abspath(), }, xml_store_options={ 'data_dir': (TEST_ROOT / "data").abspath(), }, default_store=os.environ.get('DEFAULT_STORE', 'draft'), ) # Needed to enable licensing on video modules XBLOCK_SETTINGS.update({'VideoBlock': {'licensing_enabled': True}}) # Capture the console log via template includes, until webdriver supports log capture again CAPTURE_CONSOLE_LOG = True PLATFORM_NAME = ugettext_lazy(u"édX") PLATFORM_DESCRIPTION = ugettext_lazy(u"Open édX Platform") STUDIO_NAME = ugettext_lazy(u"Your Platform 𝓢𝓽𝓾𝓭𝓲𝓸") STUDIO_SHORT_NAME = ugettext_lazy(u"𝓢𝓽𝓾𝓭𝓲𝓸")
# If we don't add these settings, then Django templates that can't # find pipelined assets will raise a ValueError. # http://stackoverflow.com/questions/12816941/unit-testing-with-django-pipeline STATICFILES_STORAGE = 'pipeline.storage.NonPackagingPipelineStorage' STATIC_URL = "/static/" BLOCK_STRUCTURES_SETTINGS['PRUNING_ACTIVE'] = True # Update module store settings per defaults for tests update_module_store_settings( MODULESTORE, module_store_options={ 'default_class': 'xmodule.hidden_module.HiddenDescriptor', 'fs_root': TEST_ROOT / "data", }, doc_store_settings={ 'db': f'test_xmodule_{THIS_UUID}', 'host': MONGO_HOST, 'port': MONGO_PORT_NUM, 'collection': 'test_modulestore', }, ) CONTENTSTORE = { 'ENGINE': 'xmodule.contentstore.mongo.MongoContentStore', 'DOC_STORE_CONFIG': { 'host': MONGO_HOST, 'db': f'test_xcontent_{THIS_UUID}', 'port': MONGO_PORT_NUM, 'collection': 'dont_trip', },
EDX_API_KEY = 'test' ECOMMERCE_API_SIGNING_KEY = 'test' ECOMMERCE_API_URL = "http://localhost:8080/api/v2/" ECOMMERCE_PUBLIC_URL_ROOT = "http://localhost:8080/" ECOMMERCE_NOTIFICATION_URL = 'http://localhost:8080/payment/paybox/notify/' ECOMMERCE_SERVICE_WORKER_USERNAME = '******' JWT_ISSUER = "http://localhost:8000/oauth2" JWT_EXPIRATION = 30 OAUTH_ENFORCE_SECURE = False OAUTH_OIDC_ISSUER = "http://localhost:8000/oauth2" # Append fun header script to verification pages # DOGWOOD: probablement plus nécessaire # PIPELINE_JS['rwd_header']['source_filenames'].append('funsite/js/header.js') # A user is verified if he has an approved SoftwareSecurePhotoVerification entry # this setting will create a dummy SoftwareSecurePhotoVerification for user in paybox success callback view # I think it's better to create a dummy one than to remove verifying process in edX FUN_ECOMMERCE_DEBUG_NO_NOTIFICATION = False ANALYTICS_DASHBOARD_URL = False # when True this setting add a link in instructor dashbord to analytics insigt service # We move split mongo store at the top of store lists to make it the # default one. Note that the 'modulestore' app makes split mongo # available even if you have not define it in your settings. update_module_store_settings(MODULESTORE, default_store='split') PROCTORU_URL_TEST = "https://test-it-out.proctoru.com"