'The set_language view can be used to change the session language.
The user is redirected to the \'next\' argument if provided.'

def test_setlang(self):

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