'When HTTP headers contains latin1 characters.'

@ddt.unpack
@ddt.data(('HTTP_USER_AGENT', 'agent'), ('PATH_INFO', 'path'), ('HTTP_REFERER', 'referer'), ('HTTP_ACCEPT_LANGUAGE', 'accept_language'))
def test_request_with_latin1_characters(self, meta_key, context_key):

    request = self.request_factory.get('/somewhere')
    request.META[meta_key] = 'test    latin1    \xd3    \xe9    \xf1'
    context = self.get_context_for_request(request)
    self.assertEqual(context[context_key], 'test    latin1    \xc3\x93    \xc3\xa9    \xc3\xb1'.decode('utf8'))
