Commit 881d0713 by Tyler Hallada Committed by GitHub

Merge pull request #361 from edx/thallada-patch-1

Support Django 1.11 in setup.py requirements
parents ef280f7d f044eaca
...@@ -14,7 +14,7 @@ import pytz ...@@ -14,7 +14,7 @@ import pytz
from django.utils.translation import ugettext as _, ugettext_noop from django.utils.translation import ugettext as _, ugettext_noop
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.template import Context, loader from django.template import loader
from django.core.urlresolvers import reverse, NoReverseMatch from django.core.urlresolvers import reverse, NoReverseMatch
from django.core.mail.message import EmailMessage from django.core.mail.message import EmailMessage
...@@ -979,18 +979,16 @@ def create_proctoring_attempt_status_email(user_id, exam_attempt_obj, course_nam ...@@ -979,18 +979,16 @@ def create_proctoring_attempt_status_email(user_id, exam_attempt_obj, course_nam
username=user.username, username=user.username,
) )
body = email_template.render( body = email_template.render({
Context({ 'username': user.username,
'username': user.username, 'course_url': course_url,
'course_url': course_url, 'course_name': course_name,
'course_name': course_name, 'exam_name': exam_name,
'exam_name': exam_name, 'status': status,
'status': status, 'platform': constants.PLATFORM_NAME,
'platform': constants.PLATFORM_NAME, 'contact_email': constants.CONTACT_EMAIL,
'contact_email': constants.CONTACT_EMAIL, 'support_email_subject': support_email_subject,
'support_email_subject': support_email_subject, })
})
)
email = EmailMessage( email = EmailMessage(
body=body, body=body,
...@@ -1513,7 +1511,6 @@ def _get_timed_exam_view(exam, context, exam_id, user_id, course_id): ...@@ -1513,7 +1511,6 @@ def _get_timed_exam_view(exam, context, exam_id, user_id, course_id):
if student_view_template: if student_view_template:
template = loader.get_template(student_view_template) template = loader.get_template(student_view_template)
django_context = Context(context)
allowed_time_limit_mins = attempt['allowed_time_limit_mins'] if attempt else None allowed_time_limit_mins = attempt['allowed_time_limit_mins'] if attempt else None
...@@ -1547,7 +1544,7 @@ def _get_timed_exam_view(exam, context, exam_id, user_id, course_id): ...@@ -1547,7 +1544,7 @@ def _get_timed_exam_view(exam, context, exam_id, user_id, course_id):
except NoReverseMatch: except NoReverseMatch:
log.exception("Can't find progress url for course %s", course_id) log.exception("Can't find progress url for course %s", course_id)
django_context.update({ context.update({
'total_time': total_time, 'total_time': total_time,
'hide_extra_time_footer': hide_extra_time_footer, 'hide_extra_time_footer': hide_extra_time_footer,
'will_be_revealed': has_due_date and not exam['hide_after_due'], 'will_be_revealed': has_due_date and not exam['hide_after_due'],
...@@ -1562,7 +1559,7 @@ def _get_timed_exam_view(exam, context, exam_id, user_id, course_id): ...@@ -1562,7 +1559,7 @@ def _get_timed_exam_view(exam, context, exam_id, user_id, course_id):
args=[attempt['id']] args=[attempt['id']]
) if attempt else '', ) if attempt else '',
}) })
return template.render(django_context) return template.render(context)
def _calculate_allowed_mins(due_datetime, allowed_mins): def _calculate_allowed_mins(due_datetime, allowed_mins):
...@@ -1663,9 +1660,8 @@ def _get_practice_exam_view(exam, context, exam_id, user_id, course_id): ...@@ -1663,9 +1660,8 @@ def _get_practice_exam_view(exam, context, exam_id, user_id, course_id):
if student_view_template: if student_view_template:
template = loader.get_template(student_view_template) template = loader.get_template(student_view_template)
django_context = Context(context) context.update(_get_proctored_exam_context(exam, attempt, course_id, is_practice_exam=True))
django_context.update(_get_proctored_exam_context(exam, attempt, course_id, is_practice_exam=True)) return template.render(context)
return template.render(django_context)
def _get_proctored_exam_view(exam, context, exam_id, user_id, course_id): def _get_proctored_exam_view(exam, context, exam_id, user_id, course_id):
...@@ -1807,9 +1803,8 @@ def _get_proctored_exam_view(exam, context, exam_id, user_id, course_id): ...@@ -1807,9 +1803,8 @@ def _get_proctored_exam_view(exam, context, exam_id, user_id, course_id):
if student_view_template: if student_view_template:
template = loader.get_template(student_view_template) template = loader.get_template(student_view_template)
django_context = Context(context) context.update(_get_proctored_exam_context(exam, attempt, course_id))
django_context.update(_get_proctored_exam_context(exam, attempt, course_id)) return template.render(context)
return template.render(django_context)
def get_student_view(user_id, course_id, content_id, def get_student_view(user_id, course_id, content_id,
......
...@@ -8,7 +8,7 @@ from __future__ import absolute_import ...@@ -8,7 +8,7 @@ from __future__ import absolute_import
import json import json
import ddt import ddt
from mock import patch from mock import MagicMock, patch
from httmock import all_requests, HTTMock from httmock import all_requests, HTTMock
from django.test import TestCase from django.test import TestCase
...@@ -87,6 +87,7 @@ def mock_response_error(url, request): # pylint: disable=unused-argument ...@@ -87,6 +87,7 @@ def mock_response_error(url, request): # pylint: disable=unused-argument
} }
} }
) )
@patch('django.core.urlresolvers.reverse', MagicMock)
@ddt.ddt @ddt.ddt
class SoftwareSecureTests(TestCase): class SoftwareSecureTests(TestCase):
""" """
......
...@@ -3,7 +3,7 @@ Various callback paths that support callbacks from SoftwareSecure ...@@ -3,7 +3,7 @@ Various callback paths that support callbacks from SoftwareSecure
""" """
import logging import logging
from django.template import Context, loader from django.template import loader
from django.conf import settings from django.conf import settings
from django.http import HttpResponse from django.http import HttpResponse
...@@ -52,12 +52,10 @@ def start_exam_callback(request, attempt_code): # pylint: disable=unused-argume ...@@ -52,12 +52,10 @@ def start_exam_callback(request, attempt_code): # pylint: disable=unused-argume
template = loader.get_template('proctored_exam/proctoring_launch_callback.html') template = loader.get_template('proctored_exam/proctoring_launch_callback.html')
return HttpResponse( return HttpResponse(
template.render( template.render({
Context({ 'platform_name': settings.PLATFORM_NAME,
'platform_name': settings.PLATFORM_NAME, 'link_urls': settings.PROCTORING_SETTINGS.get('LINK_URLS', {})
'link_urls': settings.PROCTORING_SETTINGS.get('LINK_URLS', {}) })
})
)
) )
......
...@@ -5,6 +5,7 @@ Tests for the set_attempt_status management command ...@@ -5,6 +5,7 @@ Tests for the set_attempt_status management command
from __future__ import absolute_import from __future__ import absolute_import
from datetime import datetime from datetime import datetime
from mock import MagicMock, patch
import pytz import pytz
from edx_proctoring.tests.utils import LoggedInTestCase from edx_proctoring.tests.utils import LoggedInTestCase
...@@ -18,6 +19,7 @@ from edx_proctoring.tests.test_services import ( ...@@ -18,6 +19,7 @@ from edx_proctoring.tests.test_services import (
from edx_proctoring.runtime import set_runtime_service from edx_proctoring.runtime import set_runtime_service
@patch('django.core.urlresolvers.reverse', MagicMock)
class SetAttemptStatusTests(LoggedInTestCase): class SetAttemptStatusTests(LoggedInTestCase):
""" """
Coverage of the set_attempt_status.py file Coverage of the set_attempt_status.py file
......
...@@ -10,7 +10,7 @@ from __future__ import absolute_import ...@@ -10,7 +10,7 @@ from __future__ import absolute_import
from datetime import datetime, timedelta from datetime import datetime, timedelta
import ddt import ddt
from freezegun import freeze_time from freezegun import freeze_time
from mock import patch from mock import MagicMock, patch
import pytz import pytz
from edx_proctoring.api import ( from edx_proctoring.api import (
...@@ -75,6 +75,7 @@ from .test_services import ( ...@@ -75,6 +75,7 @@ from .test_services import (
from .utils import ProctoredExamTestCase from .utils import ProctoredExamTestCase
@patch('django.core.urlresolvers.reverse', MagicMock)
@ddt.ddt @ddt.ddt
class ProctoredExamApiTests(ProctoredExamTestCase): class ProctoredExamApiTests(ProctoredExamTestCase):
""" """
......
...@@ -7,7 +7,7 @@ from __future__ import absolute_import ...@@ -7,7 +7,7 @@ from __future__ import absolute_import
import ddt import ddt
from django.core import mail from django.core import mail
from mock import patch from mock import MagicMock, patch
from edx_proctoring.api import ( from edx_proctoring.api import (
update_attempt_status, update_attempt_status,
...@@ -25,6 +25,7 @@ from .utils import ( ...@@ -25,6 +25,7 @@ from .utils import (
) )
@patch('django.core.urlresolvers.reverse', MagicMock)
@ddt.ddt @ddt.ddt
class ProctoredExamEmailTests(ProctoredExamTestCase): class ProctoredExamEmailTests(ProctoredExamTestCase):
""" """
......
...@@ -10,7 +10,7 @@ from __future__ import absolute_import ...@@ -10,7 +10,7 @@ from __future__ import absolute_import
from datetime import datetime, timedelta from datetime import datetime, timedelta
import ddt import ddt
from freezegun import freeze_time from freezegun import freeze_time
from mock import patch from mock import MagicMock, patch
import pytz import pytz
from edx_proctoring.api import ( from edx_proctoring.api import (
...@@ -33,6 +33,7 @@ from .test_services import MockCreditServiceWithCourseEndDate ...@@ -33,6 +33,7 @@ from .test_services import MockCreditServiceWithCourseEndDate
from .utils import ProctoredExamTestCase from .utils import ProctoredExamTestCase
@patch('django.core.urlresolvers.reverse', MagicMock)
@ddt.ddt @ddt.ddt
class ProctoredExamStudentViewTests(ProctoredExamTestCase): class ProctoredExamStudentViewTests(ProctoredExamTestCase):
""" """
......
...@@ -49,6 +49,9 @@ setup( ...@@ -49,6 +49,9 @@ setup(
'Development Status :: 3 - Alpha', 'Development Status :: 3 - Alpha',
'Framework :: Django', 'Framework :: Django',
'Framework :: Django :: 1.8', 'Framework :: Django :: 1.8',
'Framework :: Django :: 1.9',
'Framework :: Django :: 1.10',
'Framework :: Django :: 1.11',
'Intended Audience :: Developers', 'Intended Audience :: Developers',
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)', 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
'Natural Language :: English', 'Natural Language :: English',
...@@ -60,6 +63,6 @@ setup( ...@@ -60,6 +63,6 @@ setup(
], ],
include_package_data=True, include_package_data=True,
install_requires=[ install_requires=[
"Django>=1.8,<1.11" "Django>=1.8,<2.0"
], ],
) )
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