From: david-sarah Date: Mon, 8 Aug 2011 18:05:52 +0000 (+0000) Subject: test_node.py: test that we tolerate a UTF-8 BOM at the start of tahoe.cfg, and can... X-Git-Tag: allmydata-tahoe-1.10a1~206 X-Git-Url: https://git.rkrishnan.org/somewhere?a=commitdiff_plain;h=972beffb258d76eaf43d59ace635da73a8c7836b;p=tahoe-lafs%2Ftahoe-lafs.git 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 --- diff --git a/src/allmydata/test/test_node.py b/src/allmydata/test/test_node.py index 24ec5714..ed6898e7 100644 --- a/src/allmydata/test/test_node.py +++ b/src/allmydata/test/test_node.py @@ -70,6 +70,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