Ejemplo n.º 1
0
def setup_mock_lti_server():

    server_host = '127.0.0.1'

    # Add +1 to XQUEUE random port number
    server_port = settings.XQUEUE_PORT + 1

    address = (server_host, server_port)

    # Create the mock server instance
    server = MockLTIServer(address)
    logger.debug("LTI server started at {} port".format(str(server_port)))
    # Start the server running in a separate daemon thread
    # Because the thread is a daemon, it will terminate
    # when the main thread terminates.
    server_thread = threading.Thread(target=server.serve_forever)
    server_thread.daemon = True
    server_thread.start()

    server.oauth_settings = {
        'client_key': 'test_client_key',
        'client_secret': 'test_client_secret',
        'lti_base':  'http://{}:{}/'.format(server_host, server_port),
        'lti_endpoint': 'correct_lti_endpoint'
    }

    # Store the server instance in lettuce's world
    # so that other steps can access it
    # (and we can shut it down later)
    world.lti_server = server
Ejemplo n.º 2
0
def setup_mock_lti_server():

    server_host = '127.0.0.1'
    server_port = settings.LTI_PORT

    address = (server_host, server_port)

    # Create the mock server instance
    server = MockLTIServer(address)
    logger.debug("LTI server started at {} port".format(str(server_port)))
    # Start the server running in a separate daemon thread
    # Because the thread is a daemon, it will terminate
    # when the main thread terminates.
    server_thread = threading.Thread(target=server.serve_forever)
    server_thread.daemon = True
    server_thread.start()

    server.server_host = server_host
    server.oauth_settings = {
        'client_key': 'test_client_key',
        'client_secret': 'test_client_secret',
        'lti_base': 'http://{}:{}/'.format(server_host, server_port),
        'lti_endpoint': 'correct_lti_endpoint'
    }

    # For testing on localhost make callback url using referer host.
    server.real_callback_url_on = False

    # Store the server instance in lettuce's world
    # so that other steps can access it
    # (and we can shut it down later)
    world.lti_server = server
Ejemplo n.º 3
0
def setup_mock_lti_server():

    server_host = '127.0.0.1'
    server_port = settings.LTI_PORT

    address = (server_host, server_port)

    # Create the mock server instance
    server = MockLTIServer(address)
    logger.debug("LTI server started at {} port".format(str(server_port)))
    # Start the server running in a separate daemon thread
    # Because the thread is a daemon, it will terminate
    # when the main thread terminates.
    server_thread = threading.Thread(target=server.serve_forever)
    server_thread.daemon = True
    server_thread.start()

    server.server_host = server_host
    server.oauth_settings = {
        'client_key': 'test_client_key',
        'client_secret': 'test_client_secret',
        'lti_base':  'http://{}:{}/'.format(server_host, server_port),
        'lti_endpoint': 'correct_lti_endpoint'
    }

    # For testing on localhost make callback url using referer host.
    server.real_callback_url_on = False

    # Store the server instance in lettuce's world
    # so that other steps can access it
    # (and we can shut it down later)
    world.lti_server = server
Ejemplo n.º 4
0
def setup_mock_lti_server():

    server_host = "127.0.0.1"
    server_port = settings.LTI_PORT

    address = (server_host, server_port)

    # Create the mock server instance
    server = MockLTIServer(address)
    logger.debug("LTI server started at {} port".format(str(server_port)))
    # Start the server running in a separate daemon thread
    # Because the thread is a daemon, it will terminate
    # when the main thread terminates.
    server_thread = threading.Thread(target=server.serve_forever)
    server_thread.daemon = True
    server_thread.start()

    server.server_host = server_host
    server.oauth_settings = {
        "client_key": "test_client_key",
        "client_secret": "test_client_secret",
        "lti_base": "http://{}:{}/".format(server_host, server_port),
        "lti_endpoint": "correct_lti_endpoint",
    }

    # Flag for acceptance tests used for creating right callback_url and sending
    # graded result. Used in MockLTIRequestHandler.
    server.test_mode = True

    # Store the server instance in lettuce's world
    # so that other steps can access it
    # (and we can shut it down later)
    world.lti_server = server