From b0931dd16689ea54c7f399b19c3394742f25493d Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Mon, 4 May 2020 16:05:53 -0400 Subject: [PATCH] Move settings out of bok_choy.py to bok_choy.yml There's more to do here but get the easy ones first and make sure we didn't break anything. --- lms/envs/bok_choy.py | 130 ------------------------------------------ lms/envs/bok_choy.yml | 120 +++++++++++++++++++++++++++++++++++--- 2 files changed, 111 insertions(+), 139 deletions(-) diff --git a/lms/envs/bok_choy.py b/lms/envs/bok_choy.py index 029449bb11..cbf291d728 100644 --- a/lms/envs/bok_choy.py +++ b/lms/envs/bok_choy.py @@ -58,23 +58,11 @@ update_module_store_settings( default_store=os.environ.get('DEFAULT_STORE', 'draft'), ) -# 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") -# We need to test different scenarios, following setting effectively disbale rate limiting -PASSWORD_RESET_EMAIL_RATE_LIMIT = { - 'no_of_emails': 1, - 'per_seconds': 1 -} - ############################ 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/" @@ -92,22 +80,6 @@ WEBPACK_LOADER['DEFAULT']['STATS_FILE'] = TEST_ROOT / "staticfiles" / "lms" / "w # Don't use compression during tests PIPELINE['JS_COMPRESSOR'] = None -################################# CELERY ###################################### - -CELERY_ALWAYS_EAGER = True -CELERY_RESULT_BACKEND = 'djcelery.backends.cache:CacheBackend' - -BLOCK_STRUCTURES_SETTINGS = dict( - # We have CELERY_ALWAYS_EAGER set to True, so there's no asynchronous - # code running and the celery routing is unimportant. - # It does not make sense to retry. - TASK_MAX_RETRIES=0, - # course publish task delay is irrelevant is because the task is run synchronously - COURSE_PUBLISH_TASK_DELAY=0, - # retry delay is irrelevent because we never retry - TASK_DEFAULT_RETRY_DELAY=0, -) - ###################### Grades ###################### GRADES_DOWNLOAD = { 'STORAGE_TYPE': 'localfs', @@ -115,21 +87,6 @@ GRADES_DOWNLOAD = { 'ROOT_PATH': os.path.join(mkdtemp(), 'edx-s3', 'grades'), } -FEATURES['PERSISTENT_GRADES_ENABLED_FOR_ALL_TESTS'] = True -FEATURES['ASSUME_ZERO_GRADE_IF_ABSENT_FOR_ALL_TESTS'] = True - - -# Configure the LMS to use our stub XQueue implementation -XQUEUE_INTERFACE['url'] = 'http://localhost:8040' - -# Configure the LMS to use our stub EdxNotes implementation -EDXNOTES_PUBLIC_API = 'http://localhost:8042/api/v1' -EDXNOTES_INTERNAL_API = 'http://localhost:8042/api/v1' - -EDXNOTES_CONNECT_TIMEOUT = 10 # time in seconds -EDXNOTES_READ_TIMEOUT = 10 # time in seconds - -NOTES_DISABLED_TABS = [] LOG_OVERRIDES = [ ('track.middleware', logging.CRITICAL), @@ -139,45 +96,6 @@ LOG_OVERRIDES = [ for log_name, log_level in LOG_OVERRIDES: logging.getLogger(log_name).setLevel(log_level) -# Enable milestones app -FEATURES['MILESTONES_APP'] = True - -# Enable oauth authentication, which we test. -FEATURES['ENABLE_OAUTH2_PROVIDER'] = True -OAUTH_ENFORCE_SECURE = False - -# Enable pre-requisite course -FEATURES['ENABLE_PREREQUISITE_COURSES'] = True - -# Enable Course Discovery -FEATURES['ENABLE_COURSE_DISCOVERY'] = True - -# Enable student notes -FEATURES['ENABLE_EDXNOTES'] = True - -# Enable teams feature -FEATURES['ENABLE_TEAMS'] = True - -# Enable custom content licensing -FEATURES['LICENSING'] = True - -# Use the auto_auth workflow for creating users and logging them in -FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True -FEATURES['RESTRICT_AUTOMATIC_AUTH'] = False - -# Open up endpoint for faking Software Secure responses -FEATURES['ENABLE_SOFTWARE_SECURE_FAKE'] = True - -# Disable instructor dash buttons for downloading course data when enrollment exceeds this number -FEATURES['MAX_ENROLLMENT_INSTR_BUTTONS'] = 4 - -FEATURES['ENABLE_ENROLLMENT_TRACK_USER_PARTITION'] = True - -########################### Entrance Exams ################################# -FEATURES['ENTRANCE_EXAMS'] = True - -FEATURES['ENABLE_SPECIAL_EXAMS'] = True - YOUTUBE_HOSTNAME = os.environ.get('BOK_CHOY_HOSTNAME', '127.0.0.1') # Point the URL used to test YouTube availability to our stub YouTube server @@ -190,44 +108,9 @@ YOUTUBE['TEXT_API']['url'] = "{0}:{1}/test_transcripts_youtube/".format(YOUTUBE_ ############################# SECURITY SETTINGS ################################ # Default to advanced security in common.py, so tests can reset here to use # a simpler security model -FEATURES['ENABLE_MAX_FAILED_LOGIN_ATTEMPTS'] = False -FEATURES['SQUELCH_PII_IN_LOGS'] = False -FEATURES['PREVENT_CONCURRENT_LOGINS'] = False - -FEATURES['ENABLE_MOBILE_REST_API'] = True # Show video bumper in LMS -FEATURES['ENABLE_VIDEO_BUMPER'] = True # Show video bumper in LMS -FEATURES['SHOW_BUMPER_PERIODICITY'] = 1 - -# Enable courseware search for tests -FEATURES['ENABLE_COURSEWARE_SEARCH'] = True - -# Enable dashboard search for tests -FEATURES['ENABLE_DASHBOARD_SEARCH'] = True - -# discussion home panel, which includes a subscription on/off setting for discussion digest emails. -FEATURES['ENABLE_DISCUSSION_HOME_PANEL'] = True - -# Enable support for OpenBadges accomplishments -FEATURES['ENABLE_OPENBADGES'] = True - -FEATURES['ENABLE_LTI_PROVIDER'] = True INSTALLED_APPS.append('lti_provider.apps.LtiProviderConfig') AUTHENTICATION_BACKENDS.append('lti_provider.users.LtiBackend') -FEATURES['ENABLE_THIRD_PARTY_AUTH'] = True -THIRD_PARTY_AUTH = { - "Google": { - "SOCIAL_AUTH_GOOGLE_OAUTH2_KEY": "test", - "SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET": "test" - }, - "Facebook": { - "SOCIAL_AUTH_FACEBOOK_KEY": "test", - "SOCIAL_AUTH_FACEBOOK_SECRET": "test" - } -} - -# Use MockSearchEngine as the search engine for test scenario -SEARCH_ENGINE = "search.tests.mock_search_engine.MockSearchEngine" # Path at which to store the mock index MOCK_SEARCH_BACKING_FILE = ( TEST_ROOT / "index_file.dat" @@ -239,9 +122,6 @@ VERIFY_STUDENT["SOFTWARE_SECURE"] = { "API_SECRET_KEY": "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC", } -# this secret key should be the same as cms/envs/bok_choy.py's -SECRET_KEY = "very_secret_bok_choy_key" - # Set dummy values for profile image settings. PROFILE_IMAGE_BACKEND = { 'class': 'openedx.core.storage.OverwriteStorage', @@ -251,11 +131,6 @@ PROFILE_IMAGE_BACKEND = { }, } -BADGING_BACKEND = 'lms.djangoapps.badges.backends.tests.dummy_backend.DummyBackend' - -# Configure the LMS to use our stub eCommerce implementation -ECOMMERCE_API_URL = 'http://localhost:8043/api/v2/' - LMS_ROOT_URL = "http://localhost:{}".format(os.environ.get('BOK_CHOY_LMS_PORT', 8003)) CMS_BASE = "localhost:{}".format(os.environ.get('BOK_CHOY_CMS_PORT', 8031)) LOGIN_REDIRECT_WHITELIST = [CMS_BASE] @@ -269,11 +144,6 @@ if RELEASE_LINE == "master": 'course_author': 'https://edx.readthedocs.io/projects/edx-partner-course-staff', } -WAFFLE_OVERRIDE = True - -############## Settings for Completion API ######################### - -COMPLETION_BY_VIEWING_DELAY_MS = 1000 ##################################################################### # Lastly, see if the developer has any local overrides. diff --git a/lms/envs/bok_choy.yml b/lms/envs/bok_choy.yml index 6c36a617ff..9e555ebaaa 100644 --- a/lms/envs/bok_choy.yml +++ b/lms/envs/bok_choy.yml @@ -6,6 +6,17 @@ AWS_ACCESS_KEY_ID: '' AWS_SECRET_ACCESS_KEY: '' BUGS_EMAIL: bugs@example.com BULK_EMAIL_DEFAULT_FROM_EMAIL: no-reply@example.com +BADGING_BACKEND: 'lms.djangoapps.badges.backends.tests.dummy_backend.DummyBackend' +BLOCK_STRUCTURES_SETTINGS: + # We have CELERY_ALWAYS_EAGER set to True, so there's no asynchronous + # code running and the celery routing is unimportant. + # It does not make sense to retry. + TASK_MAX_RETRIES: 0 + # course publish task delay is irrelevant is because the task is run synchronously + COURSE_PUBLISH_TASK_DELAY: 0 + # retry delay is irrelevent because we never retry + TASK_DEFAULT_RETRY_DELAY: 0 + CACHES: celery: BACKEND: django.core.cache.backends.memcached.MemcachedCache @@ -32,6 +43,10 @@ CACHES: KEY_FUNCTION: util.memcache.safe_key KEY_PREFIX: integration_static_files LOCATION: ['localhost:11211'] + +# Capture the console log via template includes, until webdriver supports log capture again +CAPTURE_CONSOLE_LOG: True + CC_PROCESSOR: CyberSource2: {ACCESS_KEY: abcd123, PROFILE_ID: edx, PURCHASE_ENDPOINT: /shoppingcart/payment_fake, SECRET_KEY: abcd123} @@ -40,12 +55,16 @@ CELERY_BROKER_HOSTNAME: localhost CELERY_BROKER_PASSWORD: celery CELERY_BROKER_TRANSPORT: amqp CELERY_BROKER_USER: celery +CELERY_ALWAYS_EAGER: True +CELERY_RESULT_BACKEND: 'djcelery.backends.cache:CacheBackend' + CERT_QUEUE: certificates CMS_BASE: localhost:8031 CODE_JAIL: limits: {REALTIME: 3, VMEM: 0} COMMENTS_SERVICE_KEY: password COMMENTS_SERVICE_URL: http://localhost:4567 +COMPLETION_BY_VIEWING_DELAY_MS: 1000 CONTACT_EMAIL: info@example.com CONTENTSTORE: DOC_STORE_CONFIG: @@ -65,6 +84,9 @@ DATABASES: PASSWORD: '', PORT: '3306', USER: root} DEFAULT_FEEDBACK_EMAIL: feedback@example.com DEFAULT_FROM_EMAIL: registration@example.com + +# Enable debug so that static assets are served by Django +DEBUG: True DJFS: {aws_access_key_id: test, aws_secret_access_key: test, bucket: test, prefix: test, type: s3fs} DOC_STORE_CONFIG: @@ -72,18 +94,80 @@ DOC_STORE_CONFIG: db: test host: [localhost] port: 27017 +# Configure the LMS to use our stub eCommerce implementation +ECOMMERCE_API_URL: 'http://localhost:8043/api/v2/' +# Configure the LMS to use our stub EdxNotes implementation +EDXNOTES_PUBLIC_API: 'http://localhost:8042/api/v1' +EDXNOTES_INTERNAL_API: 'http://localhost:8042/api/v1' + +EDXNOTES_CONNECT_TIMEOUT: 10 # time in seconds +EDXNOTES_READ_TIMEOUT: 10 # time in seconds + +NOTES_DISABLED_TABS: [] + EMAIL_BACKEND: django.core.mail.backends.dummy.EmailBackend EVENT_TRACKING_BACKENDS: mongo: ENGINE: eventtracking.backends.mongodb.MongoBackend OPTIONS: {collection: events, database: test} -FEATURES: {ALLOW_AUTOMATED_SIGNUPS: true, AUTOMATIC_AUTH_FOR_TESTING: true, - AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING: true, CERTIFICATES_HTML_VIEW: true, - CERTIFICATES_INSTRUCTOR_GENERATION: true, CUSTOM_COURSES_EDX: true, - ENABLE_COURSE_DISCOVERY: true, ENABLE_DISCUSSION_SERVICE: true, ENABLE_GRADE_DOWNLOADS: true, - ENABLE_PAYMENT_FAKE: true, ENABLE_SPECIAL_EXAMS: true, ENABLE_THIRD_PARTY_AUTH: true, - ENABLE_VERIFIED_CERTIFICATES: true, EXPOSE_CACHE_PROGRAMS_ENDPOINT: true, MODE_CREATION_FOR_TESTING: true, - PREVIEW_LMS_BASE: 'preview.localhost:8003', RESTRICT_AUTOMATIC_AUTH: false, SHOW_HEADER_LANGUAGE_SELECTOR: true} +FEATURES: + ALLOW_AUTOMATED_SIGNUPS: true + AUTOMATIC_AUTH_FOR_TESTING: true + AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING: true + CERTIFICATES_HTML_VIEW: true + CERTIFICATES_INSTRUCTOR_GENERATION: true + CUSTOM_COURSES_EDX: true, + ENABLE_COURSE_DISCOVERY: true + ENABLE_DISCUSSION_SERVICE: true + ENABLE_GRADE_DOWNLOADS: true + ENABLE_PAYMENT_FAKE: true + ENABLE_SPECIAL_EXAMS: true + ENABLE_THIRD_PARTY_AUTH: true + ENABLE_VERIFIED_CERTIFICATES: true + EXPOSE_CACHE_PROGRAMS_ENDPOINT: true + MODE_CREATION_FOR_TESTING: true + PREVIEW_LMS_BASE: 'preview.localhost:8003' + RESTRICT_AUTOMATIC_AUTH: false + SHOW_HEADER_LANGUAGE_SELECTOR: true + ENABLE_MAX_FAILED_LOGIN_ATTEMPTS: False + SQUELCH_PII_IN_LOGS: False + PREVENT_CONCURRENT_LOGINS: False + ENABLE_MOBILE_REST_API: True # Show video bumper in LMS + ENABLE_VIDEO_BUMPER: True # Show video bumper in LMS + SHOW_BUMPER_PERIODICITY: 1 + # Enable courseware search for tests + ENABLE_COURSEWARE_SEARCH: True + # Enable dashboard search for tests + ENABLE_DASHBOARD_SEARCH: True + # discussion home panel, which includes a subscription on/off setting for discussion digest emails. + ENABLE_DISCUSSION_HOME_PANEL: True + # Enable support for OpenBadges accomplishments + ENABLE_OPENBADGES: True + ENABLE_LTI_PROVIDER: True + # Enable milestones app + MILESTONES_APP: True + # Enable oauth authentication, which we test. + ENABLE_OAUTH2_PROVIDER: True + OAUTH_ENFORCE_SECURE: False + ENABLE_PREREQUISITE_COURSES: True + ENABLE_COURSE_DISCOVERY: True + ENABLE_EDXNOTES: True + ENABLE_TEAMS: True + LICENSING: True + # Use the auto_auth workflow for creating users and logging them in + AUTOMATIC_AUTH_FOR_TESTING: True + RESTRICT_AUTOMATIC_AUTH: False + # Open up endpoint for faking Software Secure responses + ENABLE_SOFTWARE_SECURE_FAKE: True + # Disable instructor dash buttons for downloading course data when enrollment exceeds this number + MAX_ENROLLMENT_INSTR_BUTTONS: 4 + ENABLE_ENROLLMENT_TRACK_USER_PARTITION: True + ENTRANCE_EXAMS: True + ENABLE_SPECIAL_EXAMS: True + PERSISTENT_GRADES_ENABLED_FOR_ALL_TESTS: True + ASSUME_ZERO_GRADE_IF_ABSENT_FOR_ALL_TESTS: True + + GITHUB_REPO_ROOT: '** OVERRIDDEN **' JWT_AUTH: {JWT_PRIVATE_SIGNING_JWK: '{"e": "AQAB", "d": "HIiV7KNjcdhVbpn3KT-I9n3JPf5YbGXsCIedmPqDH1d4QhBofuAqZ9zebQuxkRUpmqtYMv0Zi6ECSUqH387GYQF_XvFUFcjQRPycISd8TH0DAKaDpGr-AYNshnKiEtQpINhcP44I1AYNPCwyoxXA1fGTtmkKChsuWea7o8kytwU5xSejvh5-jiqu2SF4GEl0BEXIAPZsgbzoPIWNxgO4_RzNnWs6nJZeszcaDD0CyezVSuH9QcI6g5QFzAC_YuykSsaaFJhZ05DocBsLczShJ9Omf6PnK9xlm26I84xrEh_7x4fVmNBg3xWTLh8qOnHqGko93A1diLRCrKHOvnpvgQ", "n": "o5cn3ljSRi6FaDEKTn0PS-oL9EFyv1pI7dRgffQLD1qf5D6sprmYfWWokSsrWig8u2y0HChSygR6Jn5KXBqQn6FpM0dDJLnWQDRXHLl3Ey1iPYgDSmOIsIGrV9ZyNCQwk03wAgWbfdBTig3QSDYD-sTNOs3pc4UD_PqAvU2nz_1SS2ZiOwOn5F6gulE1L0iE3KEUEvOIagfHNVhz0oxa_VRZILkzV-zr6R_TW1m97h4H8jXl_VJyQGyhMGGypuDrQ9_vaY_RLEulLCyY0INglHWQ7pckxBtI5q55-Vio2wgewe2_qYcGsnBGaDNbySAsvYcWRrqDiFyzrJYivodqTQ", @@ -126,12 +210,20 @@ MODULESTORE: - ENGINE: xmodule.modulestore.xml.XMLModuleStore NAME: xml OPTIONS: {data_dir: '** OVERRIDDEN **', default_class: xmodule.hidden_module.HiddenDescriptor} +# We need to test different scenarios, following setting effectively disbale rate limiting +PASSWORD_RESET_EMAIL_RATE_LIMIT: + no_of_emails: 1 + per_seconds: 1 PASSWORD_RESET_SUPPORT_LINK: https://support.example.com/password-reset-help.html REGISTRATION_EXTENSION_FORM: openedx.core.djangoapps.user_api.tests.test_helpers.TestCaseForm REGISTRATION_EXTRA_FIELDS: {city: hidden, country: required, gender: optional, goals: optional, honor_code: required, level_of_education: optional, mailing_address: optional, terms_of_service: hidden, year_of_birth: optional} -SECRET_KEY: '' +# Use MockSearchEngine as the search engine for test scenario +SEARCH_ENGINE: "search.tests.mock_search_engine.MockSearchEngine" +# this secret key should be the same as cms/envs/bok_choy.py's +SECRET_KEY: "very_secret_bok_choy_key" + SERVER_EMAIL: devops@example.com SESSION_COOKIE_DOMAIN: null SITE_NAME: localhost:8003 @@ -145,16 +237,26 @@ TECH_SUPPORT_EMAIL: technical@example.com THIRD_PARTY_AUTH_BACKENDS: [social_core.backends.google.GoogleOAuth2, social_core.backends.linkedin.LinkedinOAuth2, social_core.backends.facebook.FacebookOAuth2, third_party_auth.dummy.DummyBackend, third_party_auth.saml.SAMLAuthBackend] +THIRD_PARTY_AUTH: + Google: + SOCIAL_AUTH_GOOGLE_OAUTH2_KEY": "test" + SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET": "test" + Facebook: + SOCIAL_AUTH_FACEBOOK_KEY": "test" + SOCIAL_AUTH_FACEBOOK_SECRET": "test" TIME_ZONE: America/New_York TRACKING_BACKENDS: mongo: ENGINE: track.backends.mongodb.MongoBackend OPTIONS: {collection: events, database: test} WIKI_ENABLED: true +WAFFLE_OVERRIDE: True XQUEUE_INTERFACE: basic_auth: [edx, edx] django_auth: {password: password, username: lms} - url: '** OVERRIDDEN **' + # Configure the LMS to use our stub XQueue implementation + url: 'http://localhost:8040' + ZENDESK_API_KEY: '' ZENDESK_USER: ''