Commit a179657e by Will Daly

Add tests for submission step rendering

Add unavailable state for submission step

Refactor save status context

Refactor date format
parent 1806f657
......@@ -50,6 +50,12 @@ To run the Python and Javascript unit test suites:
./scripts/test.sh
To limit Python tests to a particular Django app:
.. code:: bash
./scripts/test.sh openassessment.xblock
Quality Check
=============
......
{% load tz %}
{% block list_item %}
<li id="openassessment__peer-assessment" class="openassessment__steps__step step--peer-assessment ui-toggle-visibility">
{% endblock %}
......@@ -14,14 +15,14 @@
{% if peer_start %}
<span class="step__deadline">available
<span class="date">
{{ peer_start }}
{{ peer_start|utc|date:"N j, Y H:i e" }}
(in {{ peer_start|timeuntil }})
</span>
</span>
{% elif peer_due %}
<span class="step__deadline">due
<span class="date">
{{ peer_due }}
{{ peer_due|utc|date:"N j, Y H:i e" }}
(in {{ peer_due|timeuntil }})
</span>
</span>
......
{% load tz %}
{% spaceless %}
{% block list_item %}
<li id="openassessment__response" class="openassessment__steps__step step--response ui-toggle-visibility">
......@@ -8,8 +9,20 @@
<span class="step__counter"></span>
<span class="wrapper--copy">
<span class="step__label">Your Response</span>
{% if submission_due %}
<span class="step__deadline">due <span class="date">{{ submission_due }}</span></span>
{% if submission_start %}
<span class="step__deadline">available
<span class="date">
{{ submission_start|utc|date:"N j, Y H:i e" }}
(in {{ submission_start|timeuntil }})
</span>
</span>
{% elif submission_due %}
<span class="step__deadline">due
<span class="date">
{{ submission_due|utc|date:"N j, Y H:i e" }}
(in {{ submission_due|timeuntil }})
</span>
</span>
{% endif %}
</span>
</h2>
......@@ -31,7 +44,7 @@
<p>
Please provide your response below.
{% if submission_due %}
You can save your progress and return to complete your response at any time before the due date of <span class="step__deadline"><span class="date">{{ submission_due }}</span></span>.
You can save your progress and return to complete your response at any time before the due date of <span class="step__deadline"><span class="date">{{ submission_due|utc|date:"l, N j, Y H:i e" }}</span></span>.
{% else %}
You can save your progress and return to complete your response at any time.
{% endif %}
......
{% extends "openassessmentblock/response/oa_response.html" %}
{% block list_item %}
<li id="openassessment__response" class="openassessment__steps__step step--response is--empty is--unavailable is--collapsed">
{% endblock %}
{% block title %}
<span class="step__status">
<span class="step__status__label">This step's status:</span>
<span class="step__status__value">
<span class="copy">Not Available</span>
</span>
</span>
{% endblock %}
{% block body %}
{% endblock %}
{% load i18n %}
{% load tz %}
{% spaceless %}
{% block list_item %}
<li id="openassessment__self-assessment" class="openassessment__steps__step step--self-assessment ui-toggle-visibility">
......@@ -15,14 +16,14 @@
{% if self_start %}
<span class="step__deadline">available
<span class="date">
{{ self_start }}
{{ self_start|utc|date:"N j, Y H:i e" }}
(in {{ self_start|timeuntil }})
</span>
</span>
{% elif self_due %}
<span class="step__deadline">due
<span class="date">
{{ self_due }}
{{ self_due|utc|date:"N j, Y H:i e" }}
(in {{ self_due|timeuntil }})
</span>
</span>
......
......@@ -59,9 +59,6 @@ UI_MODELS = {
}
}
DATE_FORMAT = "%A, %B %d, %Y"
DATETIME_FORMAT = "%A, %B %d, %Y %X"
def load(path):
"""Handy helper for getting resources from our kit."""
......@@ -309,35 +306,10 @@ class OpenAssessmentBlock(
if not context_dict:
context_dict = {}
if self.start:
context_dict["formatted_start_date"] = self.start.strftime(DATE_FORMAT)
context_dict["formatted_start_datetime"] = self.start.strftime(DATETIME_FORMAT)
if self.due:
context_dict["formatted_due_date"] = self.due.strftime(DATE_FORMAT)
context_dict["formatted_due_datetime"] = self.due.strftime(DATETIME_FORMAT)
template = get_template(path)
context = Context(context_dict)
return Response(template.render(context), content_type='application/html', charset='UTF-8')
def format_datetime_string(self, datetime_str):
"""Takes a datetime string, and formats it to be a user facing time.
Format a datetime string to be user facing. Datetimes are stored as
strings in the XBlock configuration for an assessment module. This
function is used to get back the Datetime object for rendering the start
and due dates on the front end.
Args:
datetime_str (str): A ISO formatted Datetime String, to be converted
to a datetime object with UTC timezone.
Returns:
datetime with UTC timezone from the given string.
"""
return dateutil.parser.parse(unicode(datetime_str)).replace(tzinfo=pytz.utc)
def add_xml_to_node(self, node):
"""
Serialize the XBlock to XML for exporting.
......
......@@ -175,10 +175,10 @@ class PeerAssessmentMixin(object):
).format(count + 2)
if reason == 'due' and problem_closed:
context_dict["peer_due"] = self.format_datetime_string(due_date)
context_dict["peer_due"] = due_date
path = 'openassessmentblock/peer/oa_peer_closed.html'
elif reason == 'start' and problem_closed:
context_dict["peer_start"] = self.format_datetime_string(start_date)
context_dict["peer_start"] = start_date
path = 'openassessmentblock/peer/oa_peer_unavailable.html'
elif workflow.get("status") == "peer":
peer_sub = self.get_peer_submission(student_item, assessment)
......
......@@ -62,10 +62,10 @@ class SelfAssessmentMixin(object):
path = 'openassessmentblock/self/oa_self_complete.html'
elif problem_closed:
if reason == 'start':
context["self_start"] = self.format_datetime_string(start_date)
context["self_start"] = start_date
path = 'openassessmentblock/self/oa_self_unavailable.html'
elif reason == 'due':
context["self_due"] = self.format_datetime_string(due_date)
context["self_due"] = due_date
path = 'openassessmentblock/self/oa_self_closed.html'
else:
submission = submission_api.get_submission(self.submission_uuid)
......
......@@ -194,24 +194,41 @@ class SubmissionMixin(object):
Submitted and graded
"""
path, context = self.submission_path_and_context()
return self.render_assessment(path, context_dict=context)
def submission_path_and_context(self):
"""
Determine the template path and context to use when
rendering the response (submission) step.
Returns:
tuple of `(path, context)`, where `path` (str) is the path to the template,
and `context` (dict) is the template context.
"""
workflow = self.get_workflow_info()
problem_closed, __, __, due_date = self.is_closed('submission')
problem_closed, reason, start_date, due_date = self.is_closed('submission')
context = {
"saved_response": self.saved_response,
"save_status": self.save_status,
"submit_enabled": self.saved_response != '',
}
path = 'openassessmentblock/response/oa_response.html'
context = {}
# Due dates can default to the distant future, in which case
# there's effectively no due date.
# If we don't add the date to the context, the template won't display it.
if due_date < DISTANT_FUTURE:
context["submission_due"] = due_date.strftime("%A, %B %d, %Y %X")
context["submission_due"] = due_date
if not workflow and problem_closed:
path = 'openassessmentblock/response/oa_response_closed.html'
if reason == 'due':
path = 'openassessmentblock/response/oa_response_closed.html'
elif reason == 'start':
context['submission_start'] = start_date
path = 'openassessmentblock/response/oa_response_unavailable.html'
elif not workflow:
context['saved_response'] = self.saved_response
context['save_status'] = self.save_status
context['submit_enabled'] = self.saved_response != ''
path = "openassessmentblock/response/oa_response.html"
elif workflow["status"] == "done":
student_submission = self.get_user_submission(
......@@ -225,4 +242,4 @@ class SubmissionMixin(object):
)
path = 'openassessmentblock/response/oa_response_submitted.html'
return self.render_assessment(path, context_dict=context)
return path, context
<openassessment submission_start="2014-04-01" submission_due="2014-04-05">
<title>Open Assessment Test</title>
<prompt>
Given the state of the world today, what do you think should be done to
combat poverty? Please answer in a short essay of 200-300 words.
</prompt>
<rubric>
<prompt>Read for conciseness, clarity of thought, and form.</prompt>
<criterion>
<name>Concise</name>
<prompt>How concise is it?</prompt>
<option points="0">
<name>Neal Stephenson (late)</name>
<explanation>Neal Stephenson explanation</explanation>
</option>
<option points="1">
<name>HP Lovecraft</name>
<explanation>HP Lovecraft explanation</explanation>
</option>
<option points="3">
<name>Robert Heinlein</name>
<explanation>Robert Heinlein explanation</explanation>
</option>
<option points="4">
<name>Neal Stephenson (early)</name>
<explanation>Neal Stephenson (early) explanation</explanation>
</option>
<option points="5">
<name>Earnest Hemingway</name>
<explanation>Earnest Hemingway</explanation>
</option>
</criterion>
<criterion>
<name>Clear-headed</name>
<prompt>How clear is the thinking?</prompt>
<option points="0">
<name>Yogi Berra</name>
<explanation>Yogi Berra explanation</explanation>
</option>
<option points="1">
<name>Hunter S. Thompson</name>
<explanation>Hunter S. Thompson explanation</explanation>
</option>
<option points="2">
<name>Robert Heinlein</name>
<explanation>Robert Heinlein explanation</explanation>
</option>
<option points="3">
<name>Isaac Asimov</name>
<explanation>Isaac Asimov explanation</explanation>
</option>
<option points="10">
<name>Spock</name>
<explanation>Spock explanation</explanation>
</option>
</criterion>
<criterion>
<name>Form</name>
<prompt>Lastly, how is its form? Punctuation, grammar, and spelling all count.</prompt>
<option points="0">
<name>lolcats</name>
<explanation>lolcats explanation</explanation>
</option>
<option points="1">
<name>Facebook</name>
<explanation>Facebook explanation</explanation>
</option>
<option points="2">
<name>Reddit</name>
<explanation>Reddit explanation</explanation>
</option>
<option points="3">
<name>metafilter</name>
<explanation>metafilter explanation</explanation>
</option>
<option points="4">
<name>Usenet, 1996</name>
<explanation>Usenet, 1996 explanation</explanation>
</option>
<option points="5">
<name>The Elements of Style</name>
<explanation>The Elements of Style explanation</explanation>
</option>
</criterion>
</rubric>
<assessments>
<assessment name="peer-assessment" must_grade="5" must_be_graded_by="3" />
<assessment name="self-assessment" />
</assessments>
</openassessment>
<openassessment>
<title>Open Assessment Test</title>
<prompt>
Given the state of the world today, what do you think should be done to
combat poverty? Please answer in a short essay of 200-300 words.
</prompt>
<rubric>
<prompt>Read for conciseness, clarity of thought, and form.</prompt>
<criterion>
<name>Concise</name>
<prompt>How concise is it?</prompt>
<option points="0">
<name>Neal Stephenson (late)</name>
<explanation>Neal Stephenson explanation</explanation>
</option>
<option points="1">
<name>HP Lovecraft</name>
<explanation>HP Lovecraft explanation</explanation>
</option>
<option points="3">
<name>Robert Heinlein</name>
<explanation>Robert Heinlein explanation</explanation>
</option>
<option points="4">
<name>Neal Stephenson (early)</name>
<explanation>Neal Stephenson (early) explanation</explanation>
</option>
<option points="5">
<name>Earnest Hemingway</name>
<explanation>Earnest Hemingway</explanation>
</option>
</criterion>
<criterion>
<name>Clear-headed</name>
<prompt>How clear is the thinking?</prompt>
<option points="0">
<name>Yogi Berra</name>
<explanation>Yogi Berra explanation</explanation>
</option>
<option points="1">
<name>Hunter S. Thompson</name>
<explanation>Hunter S. Thompson explanation</explanation>
</option>
<option points="2">
<name>Robert Heinlein</name>
<explanation>Robert Heinlein explanation</explanation>
</option>
<option points="3">
<name>Isaac Asimov</name>
<explanation>Isaac Asimov explanation</explanation>
</option>
<option points="10">
<name>Spock</name>
<explanation>Spock explanation</explanation>
</option>
</criterion>
<criterion>
<name>Form</name>
<prompt>Lastly, how is its form? Punctuation, grammar, and spelling all count.</prompt>
<option points="0">
<name>lolcats</name>
<explanation>lolcats explanation</explanation>
</option>
<option points="1">
<name>Facebook</name>
<explanation>Facebook explanation</explanation>
</option>
<option points="2">
<name>Reddit</name>
<explanation>Reddit explanation</explanation>
</option>
<option points="3">
<name>metafilter</name>
<explanation>metafilter explanation</explanation>
</option>
<option points="4">
<name>Usenet, 1996</name>
<explanation>Usenet, 1996 explanation</explanation>
</option>
<option points="5">
<name>The Elements of Style</name>
<explanation>The Elements of Style explanation</explanation>
</option>
</criterion>
</rubric>
<assessments>
<assessment name="peer-assessment" must_grade="5" must_be_graded_by="3" />
<assessment name="self-assessment" />
</assessments>
</openassessment>
<openassessment submission_start="2014-04-01" submission_due="2999-05-06">
<title>Open Assessment Test</title>
<prompt>
Given the state of the world today, what do you think should be done to
combat poverty? Please answer in a short essay of 200-300 words.
</prompt>
<rubric>
<prompt>Read for conciseness, clarity of thought, and form.</prompt>
<criterion>
<name>Concise</name>
<prompt>How concise is it?</prompt>
<option points="0">
<name>Neal Stephenson (late)</name>
<explanation>Neal Stephenson explanation</explanation>
</option>
<option points="1">
<name>HP Lovecraft</name>
<explanation>HP Lovecraft explanation</explanation>
</option>
<option points="3">
<name>Robert Heinlein</name>
<explanation>Robert Heinlein explanation</explanation>
</option>
<option points="4">
<name>Neal Stephenson (early)</name>
<explanation>Neal Stephenson (early) explanation</explanation>
</option>
<option points="5">
<name>Earnest Hemingway</name>
<explanation>Earnest Hemingway</explanation>
</option>
</criterion>
<criterion>
<name>Clear-headed</name>
<prompt>How clear is the thinking?</prompt>
<option points="0">
<name>Yogi Berra</name>
<explanation>Yogi Berra explanation</explanation>
</option>
<option points="1">
<name>Hunter S. Thompson</name>
<explanation>Hunter S. Thompson explanation</explanation>
</option>
<option points="2">
<name>Robert Heinlein</name>
<explanation>Robert Heinlein explanation</explanation>
</option>
<option points="3">
<name>Isaac Asimov</name>
<explanation>Isaac Asimov explanation</explanation>
</option>
<option points="10">
<name>Spock</name>
<explanation>Spock explanation</explanation>
</option>
</criterion>
<criterion>
<name>Form</name>
<prompt>Lastly, how is its form? Punctuation, grammar, and spelling all count.</prompt>
<option points="0">
<name>lolcats</name>
<explanation>lolcats explanation</explanation>
</option>
<option points="1">
<name>Facebook</name>
<explanation>Facebook explanation</explanation>
</option>
<option points="2">
<name>Reddit</name>
<explanation>Reddit explanation</explanation>
</option>
<option points="3">
<name>metafilter</name>
<explanation>metafilter explanation</explanation>
</option>
<option points="4">
<name>Usenet, 1996</name>
<explanation>Usenet, 1996 explanation</explanation>
</option>
<option points="5">
<name>The Elements of Style</name>
<explanation>The Elements of Style explanation</explanation>
</option>
</criterion>
</rubric>
<assessments>
<assessment name="peer-assessment" must_grade="5" must_be_graded_by="3" />
<assessment name="self-assessment" />
</assessments>
</openassessment>
<openassessment submission_start="4999-04-01">
<title>Open Assessment Test</title>
<prompt>
Given the state of the world today, what do you think should be done to
combat poverty? Please answer in a short essay of 200-300 words.
</prompt>
<rubric>
<prompt>Read for conciseness, clarity of thought, and form.</prompt>
<criterion>
<name>Concise</name>
<prompt>How concise is it?</prompt>
<option points="0">
<name>Neal Stephenson (late)</name>
<explanation>Neal Stephenson explanation</explanation>
</option>
<option points="1">
<name>HP Lovecraft</name>
<explanation>HP Lovecraft explanation</explanation>
</option>
<option points="3">
<name>Robert Heinlein</name>
<explanation>Robert Heinlein explanation</explanation>
</option>
<option points="4">
<name>Neal Stephenson (early)</name>
<explanation>Neal Stephenson (early) explanation</explanation>
</option>
<option points="5">
<name>Earnest Hemingway</name>
<explanation>Earnest Hemingway</explanation>
</option>
</criterion>
<criterion>
<name>Clear-headed</name>
<prompt>How clear is the thinking?</prompt>
<option points="0">
<name>Yogi Berra</name>
<explanation>Yogi Berra explanation</explanation>
</option>
<option points="1">
<name>Hunter S. Thompson</name>
<explanation>Hunter S. Thompson explanation</explanation>
</option>
<option points="2">
<name>Robert Heinlein</name>
<explanation>Robert Heinlein explanation</explanation>
</option>
<option points="3">
<name>Isaac Asimov</name>
<explanation>Isaac Asimov explanation</explanation>
</option>
<option points="10">
<name>Spock</name>
<explanation>Spock explanation</explanation>
</option>
</criterion>
<criterion>
<name>Form</name>
<prompt>Lastly, how is its form? Punctuation, grammar, and spelling all count.</prompt>
<option points="0">
<name>lolcats</name>
<explanation>lolcats explanation</explanation>
</option>
<option points="1">
<name>Facebook</name>
<explanation>Facebook explanation</explanation>
</option>
<option points="2">
<name>Reddit</name>
<explanation>Reddit explanation</explanation>
</option>
<option points="3">
<name>metafilter</name>
<explanation>metafilter explanation</explanation>
</option>
<option points="4">
<name>Usenet, 1996</name>
<explanation>Usenet, 1996 explanation</explanation>
</option>
<option points="5">
<name>The Elements of Style</name>
<explanation>The Elements of Style explanation</explanation>
</option>
</criterion>
</rubric>
<assessments>
<assessment name="peer-assessment" must_grade="5" must_be_graded_by="3" />
<assessment name="self-assessment" />
</assessments>
</openassessment>
......@@ -4,6 +4,8 @@ Test submission to the OpenAssessment XBlock.
"""
import json
import datetime as dt
import pytz
from mock import patch, Mock
from submissions import api as sub_api
from submissions.api import SubmissionRequestError, SubmissionInternalError
......@@ -65,17 +67,202 @@ class SubmissionTest(XBlockHandlerTestCase):
self.assertEqual(resp[1], "ENOPREVIEW")
self.assertEqual(resp[2], "To submit a response, view this component in Preview or Live mode.")
# In Studio preview mode, the runtime sets the user ID to None
@scenario('data/over_grade_scenario.xml', user_id='Alice')
def test_closed_submissions(self, xblock):
resp = self.request(xblock, 'render_submission', json.dumps(dict()))
self.assertIn("Incomplete", resp)
@scenario('data/basic_scenario.xml', user_id='Omar Little')
def test_response_submitted(self, xblock):
class SubmissionRenderTest(XBlockHandlerTestCase):
"""
Test rendering of the submission step.
To cover all states in a maintainable way, we mostly check the
template context/path without actually checking the rendered template
(although we do verify that it renders without an exception).
We then include one integration test that renders the template
to verify that everything is hooked up correctly.
"""
@scenario('data/submission_unavailable.xml', user_id="Bob")
def test_unavailable(self, xblock):
self._assert_path_and_context(
xblock, 'openassessmentblock/response/oa_response_unavailable.html',
{'submission_start': dt.datetime(4999, 4, 1).replace(tzinfo=pytz.utc)}
)
@scenario('data/submission_unavailable.xml', user_id="Bob")
def test_unavailable_submitted(self, xblock):
# If the instructor changes the start date after the problem
# has opened, it's possible for a student to have made a submission
# even though the problem is unavailable.
# In this case, we should continue showing that the student completed
# the submission.
submission = xblock.create_submission(
xblock.get_student_item_dict(),
'A man must have a code'
)
self._assert_path_and_context(
xblock, 'openassessmentblock/response/oa_response_submitted.html',
{'student_submission': submission}
)
@scenario('data/submission_open.xml', user_id="Bob")
def test_open_unanswered(self, xblock):
self._assert_path_and_context(
xblock, 'openassessmentblock/response/oa_response.html',
{
'saved_response': '',
'save_status': 'Unsaved draft',
'submit_enabled': False,
'submission_due': dt.datetime(2999, 5, 6).replace(tzinfo=pytz.utc),
}
)
@scenario('data/submission_no_deadline.xml', user_id="Bob")
def test_open_no_deadline(self, xblock):
self._assert_path_and_context(
xblock, 'openassessmentblock/response/oa_response.html',
{
'saved_response': '',
'save_status': 'Unsaved draft',
'submit_enabled': False,
}
)
@scenario('data/submission_open.xml', user_id="Bob")
def test_open_saved_response(self, xblock):
# Save a response
payload = json.dumps({'submission': 'A man must have a code'})
resp = self.request(xblock, 'save_submission', payload, response_format='json')
self.assertTrue(resp['success'])
self._assert_path_and_context(
xblock, 'openassessmentblock/response/oa_response.html',
{
'saved_response': 'A man must have a code',
'save_status': 'Saved but not submitted',
'submit_enabled': True,
'submission_due': dt.datetime(2999, 5, 6).replace(tzinfo=pytz.utc),
}
)
@scenario('data/submission_open.xml', user_id="Bob")
def test_open_submitted(self, xblock):
submission = xblock.create_submission(
xblock.get_student_item_dict(),
'A man must have a code'
)
self._assert_path_and_context(
xblock, 'openassessmentblock/response/oa_response_submitted.html',
{
'submission_due': dt.datetime(2999, 5, 6).replace(tzinfo=pytz.utc),
'student_submission': submission,
}
)
@scenario('data/submission_closed.xml', user_id="Bob")
def test_closed_incomplete(self, xblock):
self._assert_path_and_context(
xblock, 'openassessmentblock/response/oa_response_closed.html',
{
'submission_due': dt.datetime(2014, 4, 5).replace(tzinfo=pytz.utc),
}
)
@scenario('data/submission_closed.xml', user_id="Bob")
def test_closed_submitted(self, xblock):
submission = xblock.create_submission(
xblock.get_student_item_dict(),
'A man must have a code'
)
self._assert_path_and_context(
xblock, 'openassessmentblock/response/oa_response_submitted.html',
{
'submission_due': dt.datetime(2014, 4, 5).replace(tzinfo=pytz.utc),
'student_submission': submission,
}
)
@scenario('data/submission_open.xml', user_id="Bob")
def test_open_graded(self, xblock):
# Create a submission
submission = xblock.create_submission(
xblock.get_student_item_dict(),
'A man must have a code'
)
# Simulate the user receiving a grade
xblock.get_workflow_info = Mock(return_value={
'status': 'done',
'submission_uuid': submission['uuid']
})
self._assert_path_and_context(
xblock, 'openassessmentblock/response/oa_response_graded.html',
{
'submission_due': dt.datetime(2999, 5, 6).replace(tzinfo=pytz.utc),
'student_submission': submission,
}
)
@scenario('data/submission_closed.xml', user_id="Bob")
def test_closed_graded(self, xblock):
# Create a submission
submission = xblock.create_submission(
xblock.get_student_item_dict(),
'A man must have a code'
)
# Simulate the user receiving a grade
xblock.get_workflow_info = Mock(return_value={
'status': 'done',
'submission_uuid': submission['uuid']
})
self._assert_path_and_context(
xblock, 'openassessmentblock/response/oa_response_graded.html',
{
'submission_due': dt.datetime(2014, 4, 5).replace(tzinfo=pytz.utc),
'student_submission': submission,
}
)
@scenario('data/submission_open.xml', user_id="Bob")
def test_integration(self, xblock):
# Expect that the response step is open and displays the deadline
resp = self.request(xblock, 'render_submission', json.dumps(dict()))
self.assertIn('Please provide your response below', resp)
self.assertIn('Monday, May 6, 2999 00:00 UTC', resp)
# Create a submission for the user
xblock.create_submission(xblock.get_student_item_dict(), u'Ⱥ mȺn mᵾsŧ ħȺvɇ Ⱥ ȼøđɇ.')
# Expect that the response step is "submitted"
resp = self.request(xblock, 'render_submission', json.dumps(dict()))
self.assertIn('your response has been submitted', resp.lower())
def _assert_path_and_context(self, xblock, expected_path, expected_context):
"""
Render the submission step and verify that the correct template
and context were used. Also verify that the template rendered
without error.
Args:
xblock (OpenAssessmentBlock): The XBlock under test.
expected_path (str): The expected template path.
expected_context (dict): The expected template context.
Returns:
None
Raises:
AssertionError: An assertion failed.
"""
path, context = xblock.submission_path_and_context()
self.assertEqual(path, expected_path)
self.assertEqual(context, expected_context)
# Verify that we render without error
resp = self.request(xblock, 'render_submission', json.dumps({}))
self.assertGreater(len(resp), 0)
......@@ -8,7 +8,7 @@ cd `dirname $BASH_SOURCE` && cd ..
echo "Running Python tests..."
export DJANGO_SETTINGS_MODULE="settings.test"
python manage.py test
python manage.py test $1
echo "Generating HTML fixtures for JavaScript tests..."
./scripts/render_templates.py apps/openassessment/xblock/static/js/fixtures/templates.json
......
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