Files
edx-platform/common/test/acceptance/fixtures/xqueue.py
Will Daly e859a37001 Fix an issue with cache being cleared for bok_choy fast test
Change text in bok_choy scripts to green
Added feedback check for AI-assessment test
Added peer assessment feedback test
Updated Studio/LMS page objects and tests to use bok-choy v0.1.0
Added LMS bok-choy tests from e2e repo
2014-01-31 14:33:24 -05:00

42 lines
1.2 KiB
Python

"""
Fixture to configure XQueue response.
"""
import requests
import json
from . import XQUEUE_STUB_URL
class XQueueResponseFixture(object):
"""
Configure the XQueue stub's response to submissions.
"""
def __init__(self, queue_name, response_dict):
"""
Configure XQueue stub to POST `response_dict` (a dictionary)
back to the LMS when it receives a submission to a queue
named `queue_name`.
Remember that there is one XQueue stub shared by all the tests;
if possible, you should have tests use unique queue names
to avoid conflict between tests running in parallel.
"""
self._queue_name = queue_name
self._response_dict = response_dict
def install(self):
"""
Configure the stub via HTTP.
"""
url = XQUEUE_STUB_URL + "/set_config"
# Configure the stub to respond to submissions to our queue
payload = {self._queue_name: json.dumps(self._response_dict)}
response = requests.put(url, data=payload)
if not response.ok:
raise WebFixtureError(
"Could not configure XQueue stub for queue '{1}'. Status code: {2}".format(
self._queue_name, self._response_dict))