Commit 6b8574d2 by Will Daly

Remove fixtures

parent d34b5178
......@@ -56,8 +56,6 @@ coverage
# tim-specific
ora2db
testdb
fixture_err.log
apps/openassessment/xblock/static/js/fixtures/*.html
# logging
......
Fixtures
========
Dummy courseware, users, submissions, and assessments to make it easier to proof the UI in the LMS.
These are meant to be installed in a devstack VM.
See https://github.com/edx/configuration/wiki/edX-Developer-Stack for
detailed installation and troubleshooting instructions.
Usage
-----
1. Run the installation script.
```
cd edx-ora2
./fixtures/install.sh
```
**WARNING**: This will wipe out all student and course state before installing the fixtures.
2. Start the LMS:
```
cd edx-platform
rake devstack[lms]
```
3. Log in as user "proof@example.com" with password "edx".
4. In the "Tim" course, you will find problems in each of the available states.
**NOTE**: There are currently more problems in the course than states.
Generating fixtures
-------------------
To regenerate test fixtures (perhaps after running a database migration):
```
cd edx-ora2
./fixtures/dump.sh
```
This will create new JSON fixtures in edx-ora2/fixtures, which you can commit
to the edx-ora2 repo.
[
{
"pk": 1,
"model": "courseware.studentmodule",
"fields": {
"module_state_key": "i4x://edx/101/course/2014_Spring",
"created": "2014-03-12T11:34:37Z",
"grade": null,
"modified": "2014-03-12T11:34:37Z",
"state": "{\"position\": 1}",
"max_grade": null,
"module_type": "course",
"student": 2,
"course_id": "edx/101/2014_Spring",
"done": "na"
}
},
{
"pk": 2,
"model": "courseware.studentmodule",
"fields": {
"module_state_key": "i4x://edx/101/chapter/97ad3634f89e4d2083ce96b93ff60553",
"created": "2014-03-12T11:34:37Z",
"grade": null,
"modified": "2014-03-12T11:34:37Z",
"state": "{\"position\": 1}",
"max_grade": null,
"module_type": "chapter",
"student": 2,
"course_id": "edx/101/2014_Spring",
"done": "na"
}
},
{
"pk": 3,
"model": "courseware.studentmodule",
"fields": {
"module_state_key": "i4x://edx/101/sequential/891d83e4a5b046a3a65900cf475f7568",
"created": "2014-03-12T11:34:38Z",
"grade": null,
"modified": "2014-03-12T11:37:43Z",
"state": "{\"position\": 6}",
"max_grade": null,
"module_type": "sequential",
"student": 2,
"course_id": "edx/101/2014_Spring",
"done": "na"
}
},
{
"pk": 4,
"model": "courseware.studentmodule",
"fields": {
"module_state_key": "i4x://edx/101/course/2014_Spring",
"created": "2014-03-12T11:34:47Z",
"grade": null,
"modified": "2014-03-12T11:34:47Z",
"state": "{\"position\": 1}",
"max_grade": null,
"module_type": "course",
"student": 3,
"course_id": "edx/101/2014_Spring",
"done": "na"
}
},
{
"pk": 5,
"model": "courseware.studentmodule",
"fields": {
"module_state_key": "i4x://edx/101/chapter/97ad3634f89e4d2083ce96b93ff60553",
"created": "2014-03-12T11:34:47Z",
"grade": null,
"modified": "2014-03-12T11:34:47Z",
"state": "{\"position\": 1}",
"max_grade": null,
"module_type": "chapter",
"student": 3,
"course_id": "edx/101/2014_Spring",
"done": "na"
}
},
{
"pk": 6,
"model": "courseware.studentmodule",
"fields": {
"module_state_key": "i4x://edx/101/sequential/891d83e4a5b046a3a65900cf475f7568",
"created": "2014-03-12T11:34:47Z",
"grade": null,
"modified": "2014-03-12T11:37:46Z",
"state": "{\"position\": 6}",
"max_grade": null,
"module_type": "sequential",
"student": 3,
"course_id": "edx/101/2014_Spring",
"done": "na"
}
},
{
"pk": 7,
"model": "courseware.studentmodule",
"fields": {
"module_state_key": "i4x://edx/101/openassessment/bc11258e5c0a4b54a72e8fe62448bc79",
"created": "2014-03-12T11:34:55Z",
"grade": null,
"modified": "2014-03-12T11:34:55Z",
"state": "{\"submission_uuid\": \"55c6f020-a9da-11e3-976d-080027880ca6\"}",
"max_grade": null,
"module_type": "openassessment",
"student": 2,
"course_id": "edx/101/2014_Spring",
"done": "na"
}
},
{
"pk": 8,
"model": "courseware.studentmodule",
"fields": {
"module_state_key": "i4x://edx/101/openassessment/043040c0511549539c604878f51422e1",
"created": "2014-03-12T11:35:03Z",
"grade": null,
"modified": "2014-03-12T11:35:03Z",
"state": "{\"submission_uuid\": \"5a14d39a-a9da-11e3-b964-080027880ca6\"}",
"max_grade": null,
"module_type": "openassessment",
"student": 2,
"course_id": "edx/101/2014_Spring",
"done": "na"
}
},
{
"pk": 9,
"model": "courseware.studentmodule",
"fields": {
"module_state_key": "i4x://edx/101/openassessment/bc11258e5c0a4b54a72e8fe62448bc79",
"created": "2014-03-12T11:35:22Z",
"grade": null,
"modified": "2014-03-12T11:35:22Z",
"state": "{\"submission_uuid\": \"65650b3e-a9da-11e3-8b23-080027880ca6\"}",
"max_grade": null,
"module_type": "openassessment",
"student": 3,
"course_id": "edx/101/2014_Spring",
"done": "na"
}
},
{
"pk": 10,
"model": "courseware.studentmodule",
"fields": {
"module_state_key": "i4x://edx/101/openassessment/b34af6dbbfa34ad88afe2df3bfc0c6e3",
"created": "2014-03-12T11:36:04Z",
"grade": null,
"modified": "2014-03-12T11:36:04Z",
"state": "{\"submission_uuid\": \"7e8ededc-a9da-11e3-89ce-080027880ca6\"}",
"max_grade": null,
"module_type": "openassessment",
"student": 3,
"course_id": "edx/101/2014_Spring",
"done": "na"
}
},
{
"pk": 11,
"model": "courseware.studentmodule",
"fields": {
"module_state_key": "i4x://edx/101/openassessment/b34af6dbbfa34ad88afe2df3bfc0c6e3",
"created": "2014-03-12T11:36:10Z",
"grade": null,
"modified": "2014-03-12T11:36:10Z",
"state": "{\"submission_uuid\": \"822a5224-a9da-11e3-8f75-080027880ca6\"}",
"max_grade": null,
"module_type": "openassessment",
"student": 2,
"course_id": "edx/101/2014_Spring",
"done": "na"
}
},
{
"pk": 12,
"model": "courseware.studentmodule",
"fields": {
"module_state_key": "i4x://edx/101/openassessment/3557aa209bf04920947d77547aa428f1",
"created": "2014-03-12T11:36:51Z",
"grade": null,
"modified": "2014-03-12T11:36:51Z",
"state": "{\"submission_uuid\": \"9af86840-a9da-11e3-b156-080027880ca6\"}",
"max_grade": null,
"module_type": "openassessment",
"student": 2,
"course_id": "edx/101/2014_Spring",
"done": "na"
}
},
{
"pk": 13,
"model": "courseware.studentmodule",
"fields": {
"module_state_key": "i4x://edx/101/openassessment/3557aa209bf04920947d77547aa428f1",
"created": "2014-03-12T11:37:20Z",
"grade": null,
"modified": "2014-03-12T11:37:20Z",
"state": "{\"submission_uuid\": \"ac0539f6-a9da-11e3-af02-080027880ca6\"}",
"max_grade": null,
"module_type": "openassessment",
"student": 3,
"course_id": "edx/101/2014_Spring",
"done": "na"
}
},
{
"pk": 14,
"model": "courseware.studentmodule",
"fields": {
"module_state_key": "i4x://edx/101/openassessment/0b205c211e6e4606b0df248ee03df558",
"created": "2014-03-12T11:37:51Z",
"grade": null,
"modified": "2014-03-12T11:37:51Z",
"state": "{\"submission_uuid\": \"beb581f0-a9da-11e3-9b83-080027880ca6\"}",
"max_grade": null,
"module_type": "openassessment",
"student": 2,
"course_id": "edx/101/2014_Spring",
"done": "na"
}
},
{
"pk": 15,
"model": "courseware.studentmodule",
"fields": {
"module_state_key": "i4x://edx/101/openassessment/0b205c211e6e4606b0df248ee03df558",
"created": "2014-03-12T11:37:56Z",
"grade": null,
"modified": "2014-03-12T11:37:56Z",
"state": "{\"submission_uuid\": \"c18b952c-a9da-11e3-9ccf-080027880ca6\"}",
"max_grade": null,
"module_type": "openassessment",
"student": 3,
"course_id": "edx/101/2014_Spring",
"done": "na"
}
}
]
\ No newline at end of file
#!/usr/bin/env bash
FIXTURES=`dirname $BASH_SOURCE`
EDX_PLATFORM='/edx/app/edxapp/edx-platform'
$EDX_PLATFORM/manage.py lms dumpdata --settings=devstack submissions --indent 4 > $FIXTURES/submission.json
$EDX_PLATFORM/manage.py lms dumpdata --settings=devstack assessment --indent 4 > $FIXTURES/assessments.json
$EDX_PLATFORM/manage.py lms dumpdata --settings=devstack workflow --indent 4 > $FIXTURES/workflow.json
$EDX_PLATFORM/manage.py lms dumpdata --settings=devstack courseware --indent 4 > $FIXTURES/courseware.json
#!/usr/bin/env bash
######################################################################################################
#
# install.sh
#
# Install course, user, submission, and assessment fixtures for testing Open Assessment
# within the LMS / Studio.
#
# Designed to be run within a devstack VM (https://github.com/edx/configuration/wiki/edX-Developer-Stack).
#
# WARNING: This will wipe out the databases and installed courses! Use with extreme caution!
#
# Usage:
#
# ./install.sh
#
######################################################################################################
set -e
FIXTURES=`dirname $BASH_SOURCE`
EDX_PLATFORM='/edx/app/edxapp/edx-platform'
COURSE_DATA='/edx/var/edxapp/data'
COURSE_ID='edx/101/2014_Spring'
ITEM='i4x://edx/101/openassessment'
function echo_task {
echo $'\n'
echo "====== $1"
}
# Scary warning message
read -p "Warning: this will wipe out all state in the LMS and Studio. Are you sure? [Y/N] " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Cancelled."
exit 0
fi
# Drop and recreate the edxapp database
echo_task "Resetting relational database..."
mysql -u root < $FIXTURES/reset-db.sql
echo "Done"
# Clear the Mongo database
echo_task "Resetting Mongo database..."
mongo --quiet --eval 'db.getMongo().getDBNames().forEach(function(i){db.getSiblingDB(i).dropDatabase()})'
echo "Done"
# Delete any old copies of this course fixture
echo_task "Deleting courses..."
rm -rf $COURSE_DATA/2014_Spring
rm -rf $COURSE_DATA/100
echo "Done"
# Syncdb and migrate
echo_task "Creating database tables and running migrations..."
python $EDX_PLATFORM/manage.py lms syncdb --settings devstack --noinput
python $EDX_PLATFORM/manage.py lms migrate --settings devstack --noinput
echo "Done"
# Untar the course fixture
echo_task "Decompressing course fixture..."
tar -C $COURSE_DATA -zxvf $FIXTURES/2014_Spring.tar.gz
echo "Done"
# Import the course fixture
echo_task "Importing course fixture..."
python $EDX_PLATFORM/manage.py cms import $COURSE_DATA 2014_Spring --settings devstack
echo "Done"
# Create test users
echo_task "Creating test users..."
echo "Note: You may see some errors about connecting to the discussion service -- you can safely ignore these!"
python $EDX_PLATFORM/manage.py cms --settings devstack create_user -e staff@example.com -p edx -s -c $COURSE_ID
python $EDX_PLATFORM/manage.py cms --settings devstack create_user -e proof@example.com -p edx -c $COURSE_ID
python $EDX_PLATFORM/manage.py cms --settings devstack create_user -e submitter@example.com -p edx -c $COURSE_ID
echo "Done"
# Create dummy submissions and assessments
echo_task "Creating dummy submissions and assessments"
$EDX_PLATFORM/manage.py lms loaddata --settings=devstack $FIXTURES/submission.json
$EDX_PLATFORM/manage.py lms loaddata --settings=devstack $FIXTURES/assessments.json
$EDX_PLATFORM/manage.py lms loaddata --settings=devstack $FIXTURES/workflow.json
$EDX_PLATFORM/manage.py lms loaddata --settings=devstack $FIXTURES/courseware.json
echo "Done"
drop database if exists edxapp;
create database edxapp;
[
{
"pk": 1,
"model": "submissions.studentitem",
"fields": {
"course_id": "TestCourse",
"student_id": "2",
"item_id": "i4x://edx/101/openassessment/bc11258e5c0a4b54a72e8fe62448bc79",
"item_type": "openassessment"
}
},
{
"pk": 2,
"model": "submissions.studentitem",
"fields": {
"course_id": "TestCourse",
"student_id": "2",
"item_id": "i4x://edx/101/openassessment/043040c0511549539c604878f51422e1",
"item_type": "openassessment"
}
},
{
"pk": 3,
"model": "submissions.studentitem",
"fields": {
"course_id": "TestCourse",
"student_id": "3",
"item_id": "i4x://edx/101/openassessment/bc11258e5c0a4b54a72e8fe62448bc79",
"item_type": "openassessment"
}
},
{
"pk": 4,
"model": "submissions.studentitem",
"fields": {
"course_id": "TestCourse",
"student_id": "3",
"item_id": "i4x://edx/101/openassessment/b34af6dbbfa34ad88afe2df3bfc0c6e3",
"item_type": "openassessment"
}
},
{
"pk": 5,
"model": "submissions.studentitem",
"fields": {
"course_id": "TestCourse",
"student_id": "2",
"item_id": "i4x://edx/101/openassessment/b34af6dbbfa34ad88afe2df3bfc0c6e3",
"item_type": "openassessment"
}
},
{
"pk": 6,
"model": "submissions.studentitem",
"fields": {
"course_id": "TestCourse",
"student_id": "2",
"item_id": "i4x://edx/101/openassessment/3557aa209bf04920947d77547aa428f1",
"item_type": "openassessment"
}
},
{
"pk": 7,
"model": "submissions.studentitem",
"fields": {
"course_id": "TestCourse",
"student_id": "3",
"item_id": "i4x://edx/101/openassessment/3557aa209bf04920947d77547aa428f1",
"item_type": "openassessment"
}
},
{
"pk": 8,
"model": "submissions.studentitem",
"fields": {
"course_id": "TestCourse",
"student_id": "2",
"item_id": "i4x://edx/101/openassessment/0b205c211e6e4606b0df248ee03df558",
"item_type": "openassessment"
}
},
{
"pk": 9,
"model": "submissions.studentitem",
"fields": {
"course_id": "TestCourse",
"student_id": "3",
"item_id": "i4x://edx/101/openassessment/0b205c211e6e4606b0df248ee03df558",
"item_type": "openassessment"
}
},
{
"pk": 9,
"model": "submissions.submission",
"fields": {
"submitted_at": "2014-03-12T11:37:56Z",
"created_at": "2014-03-12T11:37:56Z",
"student_item": 9,
"raw_answer": "{\"text\": \"Test submission\"}",
"attempt_number": 1,
"uuid": "c18b952c-a9da-11e3-9ccf-080027880ca6"
}
},
{
"pk": 8,
"model": "submissions.submission",
"fields": {
"submitted_at": "2014-03-12T11:37:51Z",
"created_at": "2014-03-12T11:37:51Z",
"student_item": 8,
"raw_answer": "{\"text\": \"Test submission\"}",
"attempt_number": 1,
"uuid": "beb581f0-a9da-11e3-9b83-080027880ca6"
}
},
{
"pk": 7,
"model": "submissions.submission",
"fields": {
"submitted_at": "2014-03-12T11:37:20Z",
"created_at": "2014-03-12T11:37:20Z",
"student_item": 7,
"raw_answer": "{\"text\": \"Test submission\"}",
"attempt_number": 1,
"uuid": "ac0539f6-a9da-11e3-af02-080027880ca6"
}
},
{
"pk": 6,
"model": "submissions.submission",
"fields": {
"submitted_at": "2014-03-12T11:36:51Z",
"created_at": "2014-03-12T11:36:51Z",
"student_item": 6,
"raw_answer": "{\"text\": \"Test submission\"}",
"attempt_number": 1,
"uuid": "9af86840-a9da-11e3-b156-080027880ca6"
}
},
{
"pk": 5,
"model": "submissions.submission",
"fields": {
"submitted_at": "2014-03-12T11:36:10Z",
"created_at": "2014-03-12T11:36:10Z",
"student_item": 5,
"raw_answer": "{\"text\": \"Test submission\"}",
"attempt_number": 1,
"uuid": "822a5224-a9da-11e3-8f75-080027880ca6"
}
},
{
"pk": 4,
"model": "submissions.submission",
"fields": {
"submitted_at": "2014-03-12T11:36:04Z",
"created_at": "2014-03-12T11:36:04Z",
"student_item": 4,
"raw_answer": "{\"text\": \"Test submission\"}",
"attempt_number": 1,
"uuid": "7e8ededc-a9da-11e3-89ce-080027880ca6"
}
},
{
"pk": 3,
"model": "submissions.submission",
"fields": {
"submitted_at": "2014-03-12T11:35:22Z",
"created_at": "2014-03-12T11:35:22Z",
"student_item": 3,
"raw_answer": "{\"text\": \"Test submission\"}",
"attempt_number": 1,
"uuid": "65650b3e-a9da-11e3-8b23-080027880ca6"
}
},
{
"pk": 2,
"model": "submissions.submission",
"fields": {
"submitted_at": "2014-03-12T11:35:03Z",
"created_at": "2014-03-12T11:35:03Z",
"student_item": 2,
"raw_answer": "{\"text\": \"Test submission\"}",
"attempt_number": 1,
"uuid": "5a14d39a-a9da-11e3-b964-080027880ca6"
}
},
{
"pk": 1,
"model": "submissions.submission",
"fields": {
"submitted_at": "2014-03-12T11:34:55Z",
"created_at": "2014-03-12T11:34:55Z",
"student_item": 1,
"raw_answer": "{\"text\": \"Test submission\"}",
"attempt_number": 1,
"uuid": "55c6f020-a9da-11e3-976d-080027880ca6"
}
},
{
"pk": 1,
"model": "submissions.score",
"fields": {
"created_at": "2014-03-12T11:38:27Z",
"points_possible": 8,
"points_earned": 8,
"student_item": 8,
"submission": 8
}
}
]
[
{
"pk": 9,
"model": "workflow.assessmentworkflow",
"fields": {
"status": "self",
"uuid": "c18c1056-a9da-11e3-9ccf-080027880ca6",
"created": "2014-03-12T11:37:56Z",
"submission_uuid": "c18b952c-a9da-11e3-9ccf-080027880ca6",
"modified": "2014-03-12T11:38:27Z",
"status_changed": "2014-03-12T11:38:27Z"
}
},
{
"pk": 8,
"model": "workflow.assessmentworkflow",
"fields": {
"status": "done",
"uuid": "beb61a98-a9da-11e3-9b83-080027880ca6",
"created": "2014-03-12T11:37:51Z",
"submission_uuid": "beb581f0-a9da-11e3-9b83-080027880ca6",
"modified": "2014-03-12T11:38:27Z",
"status_changed": "2014-03-12T11:38:27Z"
}
},
{
"pk": 7,
"model": "workflow.assessmentworkflow",
"fields": {
"status": "peer",
"uuid": "ac05b8cc-a9da-11e3-af02-080027880ca6",
"created": "2014-03-12T11:37:20Z",
"submission_uuid": "ac0539f6-a9da-11e3-af02-080027880ca6",
"modified": "2014-03-12T11:37:20Z",
"status_changed": "2014-03-12T11:37:20Z"
}
},
{
"pk": 6,
"model": "workflow.assessmentworkflow",
"fields": {
"status": "waiting",
"uuid": "9af8f044-a9da-11e3-b156-080027880ca6",
"created": "2014-03-12T11:36:51Z",
"submission_uuid": "9af86840-a9da-11e3-b156-080027880ca6",
"modified": "2014-03-12T11:37:38Z",
"status_changed": "2014-03-12T11:37:38Z"
}
},
{
"pk": 5,
"model": "workflow.assessmentworkflow",
"fields": {
"status": "self",
"uuid": "822acf9c-a9da-11e3-8f75-080027880ca6",
"created": "2014-03-12T11:36:10Z",
"submission_uuid": "822a5224-a9da-11e3-8f75-080027880ca6",
"modified": "2014-03-12T11:36:19Z",
"status_changed": "2014-03-12T11:36:19Z"
}
},
{
"pk": 4,
"model": "workflow.assessmentworkflow",
"fields": {
"status": "peer",
"uuid": "7e8f5a42-a9da-11e3-89ce-080027880ca6",
"created": "2014-03-12T11:36:04Z",
"submission_uuid": "7e8ededc-a9da-11e3-89ce-080027880ca6",
"modified": "2014-03-12T11:36:04Z",
"status_changed": "2014-03-12T11:36:04Z"
}
},
{
"pk": 3,
"model": "workflow.assessmentworkflow",
"fields": {
"status": "peer",
"uuid": "6565931a-a9da-11e3-8b23-080027880ca6",
"created": "2014-03-12T11:35:22Z",
"submission_uuid": "65650b3e-a9da-11e3-8b23-080027880ca6",
"modified": "2014-03-12T11:35:22Z",
"status_changed": "2014-03-12T11:35:22Z"
}
},
{
"pk": 2,
"model": "workflow.assessmentworkflow",
"fields": {
"status": "peer",
"uuid": "5a164900-a9da-11e3-b964-080027880ca6",
"created": "2014-03-12T11:35:03Z",
"submission_uuid": "5a14d39a-a9da-11e3-b964-080027880ca6",
"modified": "2014-03-12T11:35:03Z",
"status_changed": "2014-03-12T11:35:03Z"
}
},
{
"pk": 1,
"model": "workflow.assessmentworkflow",
"fields": {
"status": "peer",
"uuid": "55c86b1c-a9da-11e3-976d-080027880ca6",
"created": "2014-03-12T11:34:55Z",
"submission_uuid": "55c6f020-a9da-11e3-976d-080027880ca6",
"modified": "2014-03-12T11:34:55Z",
"status_changed": "2014-03-12T11:34:55Z"
}
}
]
......@@ -15,22 +15,3 @@ echo "Generating HTML fixtures for JavaScript tests..."
echo "Running JavaScript tests..."
npm test
echo "Testing fixture import..."
# This uses the test database, because we're using test settings
rm -rf testdb
python manage.py syncdb --migrate --noinput -v 0
# There's an issue in Django 1.4 about loaddata not exiting with status 1 on error:
# https://code.djangoproject.com/ticket/20538
# Instead, we check if we can successfully match error text in the command output
if python manage.py loaddata \
fixtures/submission.json fixtures/assessments.json fixtures/workflow.json 2>&1 \
| tee fixture_err.log \
| grep -q "[Pp]roblem"; then
echo "Problem occurred when loading fixture file:"
cat fixture_err.log
exit 1
else
echo "Success!"
fi
......@@ -21,12 +21,10 @@ NOSE_ARGS = [
'--cover-erase',
]
# This will still use an in-memory database for the unit tests,
# but will create an on-disk database for testing migrations/fixture installation.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'testdb',
'NAME': '',
'USER': '',
'PASSWORD': '',
'HOST': '',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment