mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-06-27 16:11:33 +00:00
Encode the developer name in the current locale to run the test; thanks
Stefano Rivera.
This commit is contained in:
parent
a41422a7f4
commit
658946c214
@ -18,6 +18,7 @@
|
|||||||
import __builtin__
|
import __builtin__
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import locale
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
|
|
||||||
import mox
|
import mox
|
||||||
@ -213,6 +214,10 @@ class UbuEmailTestCase(unittest.TestCase):
|
|||||||
self.assertEqual(os.environ['DEBEMAIL'], orig)
|
self.assertEqual(os.environ['DEBEMAIL'], orig)
|
||||||
|
|
||||||
def test_unicode_name(self):
|
def test_unicode_name(self):
|
||||||
os.environ['DEBFULLNAME'] = name = 'Jöe Déveloper'
|
encoding = locale.getdefaultlocale()[1]
|
||||||
|
if not encoding:
|
||||||
|
encoding = 'utf-8'
|
||||||
|
name = 'Jöe Déveloper'.decode('utf-8')
|
||||||
|
os.environ['DEBFULLNAME'] = name.encode(encoding)
|
||||||
os.environ['DEBEMAIL'] = email = 'joe@example.net'
|
os.environ['DEBEMAIL'] = email = 'joe@example.net'
|
||||||
self.assertEqual(ubu_email(), (name.decode('utf-8'), email))
|
self.assertEqual(ubu_email(), (name, email))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user