Example #1
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)
Example #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)
Example #3
0
    def tearDown(self):
        """Stop each of the listening services to free up the ports"""
        self.response_listener.stop()

        # Stop the workers we started earlier
        PassiveGraderStub.stop_workers()

        # Delete the queue we created
        PassiveGraderStub.delete_queue(MatlabGraderTest.QUEUE_NAME)
Example #4
0
    def tearDown(self):
        """Stop each of the listening services to free up the ports"""
        self.response_listener.stop()

        # Stop the workers we started earlier
        PassiveGraderStub.stop_workers()

        # Delete the queue we created
        PassiveGraderStub.delete_queue(MatlabGraderTest.QUEUE_NAME)
    def __init__(self, response_dict):
        """
        Configure the stub to always respond with the same message

        response_dict: JSON-serializable dict to send in response to
            a submission.
        """
        self._response_dict = response_dict
        PassiveGraderStub.__init__(self)
Example #6
0
    def __init__(self, response_dict):
        """
        Configure the stub to always respond with the same message

        response_dict: JSON-serializable dict to send in response to
            a submission.
        """
        self._response_dict = response_dict
        PassiveGraderStub.__init__(self)
    def tearDown(self):
        """Stop each of the listening services to free up the ports"""
        self.response_listener.stop()

        # Stop the workers we started earlier
        PassiveGraderStub.stop_workers()
    def tearDown(self):
        """Stop each of the listening services to free up the ports"""
        self.response_listener.stop()

        # Stop the workers we started earlier
        PassiveGraderStub.stop_workers()