don't pass unicode names cef can't cope with (bug 791292)

This commit is contained in:
Andy McKay 2012-10-11 11:18:30 -07:00
Родитель d131fe280a
Коммит 7a941fcbda
2 изменённых файлов: 19 добавлений и 1 удалений

Просмотреть файл

@ -55,7 +55,9 @@ class CEFLogger:
'suid': str(getattr(user, 'pk', '')),
'signature': '%s%s' % (self.sig_prefix, msg.upper()),
'msg': longer, 'config': c,
'cs2': app, 'cs2Label': self.cs2label}
# Until the CEF log can cope with unicode app names, just
# use primary keys.
'cs2': app.pk, 'cs2Label': self.cs2label}
if extra_kwargs:
kwargs.update(extra_kwargs)

Просмотреть файл

@ -1,3 +1,4 @@
# -*- coding: utf8 -*-
import json
from django.conf import settings
@ -313,6 +314,21 @@ class TestReceiptIssue(amo.tests.TestCase):
eq_(res.status_code, 200)
eq_(create_receipt.call_args[1]['flavour'], 'developer')
@mock.patch('mkt.receipts.views.create_receipt')
def test_unicode_name(self, create_receipt):
"""
Regression test to ensure that the CEF log works. Pass through the
app.pk instead of the full unicode name, until the CEF library is
fixed, or metlog is used.
"""
create_receipt.return_value = 'foo'
self.app.name = u'\u0627\u0644\u062a\u0637\u0628-news'
self.app.save()
self.client.login(username=self.reviewer.email, password='password')
res = self.client.post(self.url)
eq_(res.status_code, 200)
class TestReceiptCheck(amo.tests.TestCase):
fixtures = ['base/users', 'webapps/337141-steamcube']