Fix some failing tests.

This commit is contained in:
Itamar Turner-Trauring 2020-10-30 13:59:57 -04:00
parent 6b4be7aee3
commit 6264cf15b1
3 changed files with 8 additions and 13 deletions

View File

@ -131,7 +131,7 @@ def _valid_config():
return cfg.update(_client_config)
# this is put into README in new node-directories
CLIENT_README = """
CLIENT_README = u"""
This directory contains files which contain private data for the Tahoe node,
such as private keys. On Unix-like systems, the permissions on this directory
are set to disallow users other than its owner from reading the contents of
@ -512,7 +512,7 @@ def create_introducer_clients(config, main_tub, _introducer_factory=None):
config.nickname,
str(allmydata.__full_version__),
str(_Client.OLDEST_SUPPORTED_VERSION),
node.get_app_versions(),
list(node.get_app_versions()),
partial(_sequencer, config),
introducer_cache_filepath,
)

View File

@ -106,8 +106,8 @@ def formatTimeTahoeStyle(self, when):
"""
d = datetime.datetime.utcfromtimestamp(when)
if d.microsecond:
return d.isoformat(" ")[:-3]+"Z"
return d.isoformat(" ") + ".000Z"
return d.isoformat(ensure_str(" "))[:-3]+"Z"
return d.isoformat(ensure_str(" ")) + ".000Z"
PRIV_README = """
This directory contains files which contain private data for the Tahoe node,
@ -161,6 +161,7 @@ def create_node_dir(basedir, readme_text):
privdir = os.path.join(basedir, "private")
if not os.path.exists(privdir):
fileutil.make_dirs(privdir, 0o700)
readme_text = ensure_text(readme_text)
with open(os.path.join(privdir, 'README'), 'w') as f:
f.write(readme_text)

View File

@ -112,11 +112,11 @@ class Basic(testutil.ReallyEqualMixin, unittest.TestCase):
@defer.inlineCallbacks
def test_comment(self):
"""
An unescaped comment character (#) in a furl results in an
A comment character (#) in a furl results in an
UnescapedHashError Failure.
"""
should_fail = [r"test#test", r"#testtest", r"test\\#test"]
should_not_fail = [r"test\#test", r"test\\\#test", r"testtest"]
should_fail = [r"test#test", r"#testtest", r"test\\#test", r"test\#test",
r"test\\\#test"]
basedir = "test_client.Basic.test_comment"
os.mkdir(basedir)
@ -127,17 +127,11 @@ class Basic(testutil.ReallyEqualMixin, unittest.TestCase):
fileutil.write(os.path.join(basedir, "tahoe.cfg"), config)
for s in should_fail:
self.failUnless(_Config._contains_unescaped_hash(s))
write_config(s)
with self.assertRaises(UnescapedHashError) as ctx:
yield client.create_client(basedir)
self.assertIn("[client]introducer.furl", str(ctx.exception))
for s in should_not_fail:
self.failIf(_Config._contains_unescaped_hash(s))
write_config(s)
yield client.create_client(basedir)
def test_unreadable_config(self):
if sys.platform == "win32":
# if somebody knows a clever way to do this (cause