'Tests that the right url protocol is included in the reset password link'

@unittest.skipUnless((settings.ROOT_URLCONF == 'lms.urls'), 'Test    only    valid    in    LMS')
@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):

    req = self.request_factory.post('/password_reset/', {'email': self.user.email})
    req.is_secure = Mock(return_value=is_secure)
    req.user = self.user
    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)
    self.assert_event_emitted(SETTING_CHANGE_INITIATED, user_id=self.user.id, setting=u'password', old=None, new=None)
