def test_change_language_with_referer(self):
     self.set_logged(user='******')
     referer = 'http://localhost/profile/'
     response = self.testapp.get('/set_language/?lang=sv',
                                 extra_environ={
                                     'HTTP_REFERER': referer
                                 },
                                 status=302)
     self.assertIsNotNone(response.cookies_set.get('lang', 'sv'))
     self.assertEqual(response.location, referer)
     response = self.testapp.get(referer, status=200)
     lang_name = read_mapping(self.settings, 'available_languages')['sv']
     self.assertIn('<span>{0}</span>'.format(lang_name), response.body)
 def test_get_default_lang(self):
     self.set_logged(user='******')
     response = self.testapp.get('/profile/')
     lang_name = read_mapping(self.settings, 'available_languages')[self.default_language]
     self.assertIn('<span>{0}</span>'.format(lang_name),
                   response.body)