'The set_language view redirects to the "next" parameter for AJAX calls.'

def test_setlang_performs_redirect_for_ajax_if_explicitly_requested(self):

    lang_code = self._get_inactive_language_code()
    post_data = {'language': lang_code, 'next': '/'}
    response = self.client.post('/i18n/setlang/', post_data, HTTP_X_REQUESTED_WITH='XMLHttpRequest')
    self.assertRedirects(response, '/')
    self.assertEqual(self.client.session[LANGUAGE_SESSION_KEY], lang_code)
