def __init__(self):

        # Attempt to load settings for the Mathworks servers
        self.api_key = settings.MATHWORKS_API_KEY

        # Fail immediately if settings are missing
        # Check the configuration in test_env.json
        # (see xqueue.test_settings for details)
        assert(self.api_key is not None)

        # Initialize as many response listeners as we have
        # problems.  A submission to a problem will go
        # to a specific response listener.
        self.response_listeners = []
        self.clients = []
        for i in range(Transaction.NUM_PROBLEMS):

            # Create the response listener
            # This is unique for our test, so we can capture
            # responses only for the submissions we sent
            listener = GradeResponseListener()
            self.response_listeners.append(listener)

            # Create a client that submits to this problem
            # (configure it so the xqueue will send its response
            # to this response listener)
            client = XQueueTestClient(listener.port_num())
            self.clients.append(client)

        # Log in and store the session
        self.session = self._log_in()
Exemple #2
0
    def setUp(self):
        """Set up the client and stubs to be used across tests."""

        # Attempt to load settings for the Mathworks servers
        self.api_key = settings.MATHWORKS_API_KEY
        self.grader_url = settings.XQUEUES.get('matlab', None)

        # Skip if the settings are missing
        if self.api_key is None or self.grader_url is None:
            raise SkipTest(
                'You must specify an API key and URL for Mathworks in test_env.json'
            )

        # Create the response listener
        # which listens for responses on an open port
        self.response_listener = GradeResponseListener()

        # Create the client (input submissions)
        # and configure it to send messages
        # that xqueue will send to our response listener
        self.client = XQueueTestClient(self.response_listener.port_num())

        # Create the user and make sure we are logged in
        XQueueTestClient.create_user('test', '*****@*****.**', 'password')
        self.client.login(username='******', password='******')

        # Start up workers to pull messages from the queue
        # and forward them to our grader
        PassiveGraderStub.start_workers_for_grader_url(
            MatlabGraderTest.QUEUE_NAME, self.grader_url)
Exemple #3
0
    def setUp(self):
        """Set up the client and stubs to be used across tests."""
        # Create the grader
        self.grader = SimpleActiveGrader(ActiveGraderTest.QUEUE_NAME,
                                         ActiveGraderTest.GRADER_RESPONSE)

        # Create the response listener
        # and configure it to receive messages on a local port
        self.response_listener = GradeResponseListener()

        # Create the client (input submissions)
        # and configure it to send messages
        # that will be sent back to our response listener
        self.client = XQueueTestClient(self.response_listener.port_num())

        # Create the user and make sure we are logged in
        XQueueTestClient.create_user('test', '*****@*****.**', 'password')
        self.client.login(username='******', password='******')