Commit 692de26c by Matt Drayer

Merge pull request #265 from edx-solutions/aspen-merge

Aspen release - Merge additional commits since RC
parents 7b74fe4d a11409e0
...@@ -16,12 +16,14 @@ from django.utils.http import int_to_base36 ...@@ -16,12 +16,14 @@ from django.utils.http import int_to_base36
from mock import Mock, patch from mock import Mock, patch
from textwrap import dedent from textwrap import dedent
import ddt
from student.views import password_reset, password_reset_confirm_wrapper from student.views import password_reset, password_reset_confirm_wrapper
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
from student.tests.test_email import mock_render_to_string from student.tests.test_email import mock_render_to_string
@ddt.ddt
class ResetPasswordTests(TestCase): class ResetPasswordTests(TestCase):
""" Tests that clicking reset password sends email, and doesn't activate the user """ Tests that clicking reset password sends email, and doesn't activate the user
""" """
...@@ -121,6 +123,30 @@ class ResetPasswordTests(TestCase): ...@@ -121,6 +123,30 @@ class ResetPasswordTests(TestCase):
self.assertFalse(self.user.is_active) self.assertFalse(self.user.is_active)
re.search(r'password_reset_confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/', msg).groupdict() re.search(r'password_reset_confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/', msg).groupdict()
@unittest.skipIf(
settings.FEATURES.get('DISABLE_RESET_EMAIL_TEST', False),
dedent("""
Skipping Test because CMS has not provided necessary templates for password reset.
If LMS tests print this message, that needs to be fixed.
""")
)
@patch('django.core.mail.send_mail')
@ddt.data((False, 'http://'), (True, 'https://'))
@ddt.unpack
def test_reset_password_email_https(self, is_secure, protocol, send_email):
"""
Tests that the right url protocol is included in the reset password link
"""
req = self.request_factory.post(
'/password_reset/', {'email': self.user.email}
)
req.is_secure = Mock(return_value=is_secure)
resp = password_reset(req)
_, msg, _, _ = send_email.call_args[0]
expected_msg = "Please go to the following page and choose a new password:\n\n" + protocol
self.assertIn(expected_msg, msg)
@patch('student.views.password_reset_confirm') @patch('student.views.password_reset_confirm')
def test_reset_password_bad_token(self, reset_confirm): def test_reset_password_bad_token(self, reset_confirm):
"""Tests bad token and uidb36 in password reset""" """Tests bad token and uidb36 in password reset"""
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
{% trans "Please go to the following page and choose a new password:" %} {% trans "Please go to the following page and choose a new password:" %}
{% block reset_link %} {% block reset_link %}
http{% if is_secure %}s{% endif %}://{{domain}}{% url 'student.views.password_reset_confirm_wrapper' uidb36=uid token=token %} {{ protocol }}://{{domain}}{% url 'student.views.password_reset_confirm_wrapper' uidb36=uid token=token %}
{% endblock %} {% endblock %}
{% trans "If you didn't request this change, you can disregard this email - we have not yet reset your password." %} {% trans "If you didn't request this change, you can disregard this email - we have not yet reset your password." %}
......
...@@ -143,4 +143,3 @@ git+https://github.com/mitocw/django-cas.git ...@@ -143,4 +143,3 @@ git+https://github.com/mitocw/django-cas.git
# edX packages # edX packages
edx-submissions==0.0.7 edx-submissions==0.0.7
-e git+https://github.com/pmitros/django-pyfs.git@514607d78535fd80bfd23184cd292ee5799b500d#egg=djpyfs
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
-e git+https://github.com/un33k/django-ipware.git@42cb1bb1dc680a60c6452e8bb2b843c2a0382c90#egg=django-ipware -e git+https://github.com/un33k/django-ipware.git@42cb1bb1dc680a60c6452e8bb2b843c2a0382c90#egg=django-ipware
-e git+https://github.com/appliedsec/pygeoip.git@95e69341cebf5a6a9fbf7c4f5439d458898bdc3b#egg=pygeoip -e git+https://github.com/appliedsec/pygeoip.git@95e69341cebf5a6a9fbf7c4f5439d458898bdc3b#egg=pygeoip
-e git+https://github.com/jazkarta/edx-jsme.git@813079fd5218ed275248d2a1fcae2fcbf20a0838#egg=edx-jsme -e git+https://github.com/jazkarta/edx-jsme.git@813079fd5218ed275248d2a1fcae2fcbf20a0838#egg=edx-jsme
-e git+https://github.com/pmitros/django-pyfs.git@d175715e0fe3367ec0f1ee429c242d603f6e8b10#egg=djpyfs
# Our libraries: # Our libraries:
-e git+https://github.com/edx-solutions/XBlock.git@4dc416c2af4c4863fc3834fb80c7682cb9e3fd19#egg=XBlock -e git+https://github.com/edx-solutions/XBlock.git@4dc416c2af4c4863fc3834fb80c7682cb9e3fd19#egg=XBlock
......
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