'Tests that the right url domain and platform name is included in
the reset password email'

@unittest.skipUnless((settings.ROOT_URLCONF == 'lms.urls'), 'Test    only    valid    in    LMS')
@patch('openedx.core.djangoapps.site_configuration.helpers.get_value', fake_get_value)
@patch('django.core.mail.send_mail')
def test_reset_password_email_configuration_override(self, send_email):

    req = self.request_factory.post('/password_reset/', {'email': self.user.email})
    req.get_host = Mock(return_value=None)
    req.user = self.user
    password_reset(req)
    (_, msg, from_addr, _) = send_email.call_args[0]
    reset_msg = 'you    requested    a    password    reset    for    your    user    account    at    {}'.format(fake_get_value('platform_name'))
    self.assertIn(reset_msg, msg)
    self.assert_event_emitted(SETTING_CHANGE_INITIATED, user_id=self.user.id, setting=u'password', old=None, new=None)
    self.assertEqual(from_addr, 'no-reply@fakeuniversity.com')
