From f4cc735e93a4861fd4ce4d97a422a6f1c924b4a3 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Thu, 5 Sep 2013 18:08:10 +0100 Subject: [PATCH] Mon Aug 8 19:05:52 BST 2011 david-sarah@jacaranda.org * test_node.py: test that we tolerate a UTF-8 BOM at the start of tahoe.cfg, and can read UTF-8 option values. refs #1470 --- src/allmydata/test/test_node.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/allmydata/test/test_node.py b/src/allmydata/test/test_node.py index 9d7a296f..4c1bbc01 100644 --- a/src/allmydata/test/test_node.py +++ b/src/allmydata/test/test_node.py @@ -72,6 +72,21 @@ class TestCase(testutil.SignalMixin, unittest.TestCase): d.addCallback(_check_addresses) return d + def test_tahoe_cfg_utf8(self): + basedir = "test_node/test_tahoe_cfg_utf8" + fileutil.make_dirs(basedir) + f = open(os.path.join(basedir, 'tahoe.cfg'), 'wt') + f.write(u"\uFEFF[node]\n".encode('utf-8')) + f.write(u"nickname = \u2621\n".encode('utf-8')) + f.close() + + n = TestNode(basedir) + n.setServiceParent(self.parent) + d = n.when_tub_ready() + d.addCallback(lambda ign: self.failUnlessEqual(n.get_config("node", "nickname").decode('utf-8'), + u"\u2621")) + return d + def test_timestamp(self): # this modified logger doesn't seem to get used during the tests, # probably because we don't modify the LogObserver that trial -- 2.45.2