-
Notifications
You must be signed in to change notification settings - Fork 7
Developing qbank locally
Once you have your local environment set up (using either Docker containers or virtualenv is recommended), you need to install the project requirements:
pip install -r requirements.txt
After you've installed the dependencies, running qbank
is as simple as:
python main.py
This will start the qbank
server on port 8080
. You can change the default port if needed by doing
python main.py <new port>
Like
python main.py 8888
You can then access the api via https
, for example: https://localhost:8080/version
.
For additional api endpoints and data on how to use them, please refer to the docs.
qbank
uses pytest
to check conformance with pep8
and the unit / functional tests.
To make sure the tests run correctly with authorization, you need to add a settings.py
file in the project's root directory, with the following value:
AUTHZ_USER = "[email protected]"
When you switch to a production environment with authorization enabled, you need to update that value and keep it a secret.
Test dependencies are located in test_requirements.txt
and can be installed with:
pip install -r test_requirements.txt
There are several test files that try to cover all use cases for qbank
in the CLIx project.
Tests various generic aspects of the assessment api, including tests for non-CLIx question types.
Tests the various media accessibility traits, like altText
, mediaDescription
, vttFile
and transcript
files. On the authoring side, makes sure that can set, update, and remove each of those values. On the assessment-taking side, makes sure that each of those comes back in the requested language and in the right spot in the question markup.
Tests all aspects of authoring and taking drag-and-drop questions, including creation of zones
, droppables
, and targets
. Also makes sure that the labels and names come back in the requested language.
Tests the logging endpoints.
Mostly tests that the upload of qti
v2.1
zip files works for the supported question types. Also makes sure the XML returns correctly.
Tests the saving and creation of media assets, as well as the streaming.
Tests the api for creating and updating the supported question types via REST (instead of qti
zip files).
You can run all the tests via:
pytest
To run only a subset or a specific test, you can do things like:
pytest tests/test_assessment.py
pytest tests/test_assessment.py::AnswerTypeTests
pytest tests/test_assessment.py::AnswerTypeTests::test_default_answer_genus_is_right_answer_when_not_specified
You can also include the -x
flag to stop the tests on the first failure.
pytest -x