from xena.pages.email_templates_page import EmailTemplatesPage from xena.pages.instructor_page import InstructorPage from xena.pages.jobs_page import JobsPage from xena.pages.kaltura_page import KalturaPage from xena.pages.login_page import LoginPage from xena.pages.ouija_board_page import OuijaBoardPage from xena.pages.room_page import RoomPage from xena.pages.room_printable_page import RoomPrintablePage from xena.pages.rooms_page import RoomsPage from xena.pages.sign_up_page import SignUpPage from xena.test_utils.webdriver_manager import WebDriverManager os.environ['DIABLO_ENV'] = 'xena' # noqa _app = create_app(standalone=True) # Create app context before running tests. ctx = _app.app_context() ctx.push() @pytest.fixture(scope='session') def page_objects(request): driver = WebDriverManager.launch_browser() term = Term() # Define page objects attic_page = AtticPage(driver) blackouts_page = BlackoutsPage(driver) canvas_page = CanvasPage(driver)
import os from diablo.factory import create_app import pytest from xena.models.recording_schedule import RecordingSchedule from xena.models.section import Section from xena.pages.login_page import LoginPage from xena.pages.ouija_board_page import OuijaBoardPage from xena.pages.sign_up_page import SignUpPage from xena.test_utils import util from xena.test_utils.webdriver_manager import WebDriverManager os.environ['DIABLO_ENV'] = 'xena' # noqa _app = create_app() # Create app context before running tests. ctx = _app.app_context() ctx.push() @pytest.fixture(scope='session') def sign_up_0_test(request): driver = WebDriverManager.launch_browser() # Reset course data in Diablo and Kaltura test_data = util.parse_sign_up_test_data() util.reset_test_data(test_data[0]) # Define the course data for the test
# environment, sourcing from the Elastic Beanstalk-provided /opt/python/current/env file if available. if __name__.startswith('_mod_wsgi'): command = ['bash', '-c', '{ source /opt/python/current/env || true; } && env'] shell_environment = subprocess.Popen(command, stdout=subprocess.PIPE) for line in shell_environment.stdout: key, _, value = line.decode('utf-8').rstrip().partition('=') os.environ[key] = value # Grab the current EC2 instance id and stash it in an environment variable. try: instance_metadata = subprocess.Popen(['ec2-metadata', '-i'], stdout=subprocess.PIPE) os.environ['EC2_INSTANCE_ID'] = next(instance_metadata.stdout).decode('utf-8').partition(':')[2].strip() except Exception: pass application = create_app() @application.cli.command() def initdb(): from diablo.models import development_db development_db.load(create_test_data=False) host = application.config['HOST'] port = application.config['PORT'] if __name__ == '__main__': application.logger.info('Starting development server on %s:%s', host, port) application.run(host=host, port=port) elif __name__.startswith('_mod_wsgi'):
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. """ import os import sys import time abspath = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) sys.path.append(abspath) import click # noqa from diablo.factory import create_app # noqa application = create_app(standalone=True) @application.cli.command('delete_scheduled_events_from_kaltura') @click.argument('rehearsal', default=False) def delete_kaltura_events(rehearsal): """Delete Kaltura events created by Diablo.""" with application.app_context(): from diablo.externals.kaltura import CREATED_BY_DIABLO_TAG, Kaltura def _print(message): print(f""" {'[REHEARSAL MODE]: ' if rehearsal else ''}{message} """) _print('Time for some Kaltura housekeeping...')