mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-24 15:16:41 +00:00
test_client.py: repair Basic.test_error_on_old_config_files. refs #1385
This commit is contained in:
parent
1c77c5f5dc
commit
b6cfbbeb23
@ -30,36 +30,40 @@ class Basic(testutil.ReallyEqualMixin, unittest.TestCase):
|
|||||||
BASECONFIG)
|
BASECONFIG)
|
||||||
client.Client(basedir)
|
client.Client(basedir)
|
||||||
|
|
||||||
@mock.patch('allmydata.util.log.err')
|
@mock.patch('twisted.python.log.msg')
|
||||||
def test_warn_on_old_config_files(self, mocklogerr):
|
def test_error_on_old_config_files(self, mock_log_msg):
|
||||||
basedir = "test_client.Basic.test_warn_on_old_config_files"
|
basedir = "test_client.Basic.test_error_on_old_config_files"
|
||||||
os.mkdir(basedir)
|
os.mkdir(basedir)
|
||||||
fileutil.write(os.path.join(basedir, "tahoe.cfg"), \
|
fileutil.write(os.path.join(basedir, "tahoe.cfg"),
|
||||||
BASECONFIG + \
|
BASECONFIG +
|
||||||
"[storage]\n" + \
|
"[storage]\n" +
|
||||||
"enabled = false\n" + \
|
"enabled = false\n" +
|
||||||
"reserved_space = bogus\n")
|
"reserved_space = bogus\n")
|
||||||
fileutil.write(os.path.join(basedir, "introducer.furl"), "")
|
fileutil.write(os.path.join(basedir, "introducer.furl"), "")
|
||||||
fileutil.write(os.path.join(basedir, "no_storage"), "")
|
fileutil.write(os.path.join(basedir, "no_storage"), "")
|
||||||
fileutil.write(os.path.join(basedir, "readonly_storage"), "")
|
fileutil.write(os.path.join(basedir, "readonly_storage"), "")
|
||||||
fileutil.write(os.path.join(basedir, "debug_discard_storage"), "")
|
fileutil.write(os.path.join(basedir, "debug_discard_storage"), "")
|
||||||
|
|
||||||
e = self.failUnlessRaises(OldConfigError, client.Client, basedir)
|
e = self.failUnlessRaises(OldConfigError, client.Client, basedir)
|
||||||
self.failUnlessIn(os.path.abspath(os.path.join(basedir, u"introducer.furl")), e.args[0])
|
self.failUnlessIn(os.path.abspath(os.path.join(basedir, "introducer.furl")), e.args[0])
|
||||||
self.failUnlessIn(os.path.abspath(os.path.join(basedir, "no_storage")), e.args[0])
|
self.failUnlessIn(os.path.abspath(os.path.join(basedir, "no_storage")), e.args[0])
|
||||||
self.failUnlessIn(os.path.abspath(os.path.join(basedir, "readonly_storage")), e.args[0])
|
self.failUnlessIn(os.path.abspath(os.path.join(basedir, "readonly_storage")), e.args[0])
|
||||||
self.failUnlessIn(os.path.abspath(os.path.join(basedir, "debug_discard_storage")), e.args[0])
|
self.failUnlessIn(os.path.abspath(os.path.join(basedir, "debug_discard_storage")), e.args[0])
|
||||||
for oldfile in [u'introducer.furl', 'no_storage', 'readonly_storage',
|
|
||||||
|
for oldfile in ['introducer.furl', 'no_storage', 'readonly_storage',
|
||||||
'debug_discard_storage']:
|
'debug_discard_storage']:
|
||||||
warned = [ m for m in mocklogerr.call_args_list if ("Found pre-Tahoe-LAFS-v1.3 configuration file" in m[0][0] and oldfile in m[0][0]) ]
|
logged = [ m for m in mock_log_msg.call_args_list if
|
||||||
self.failUnless(warned, (oldfile, mocklogerr.call_args_list))
|
("Found pre-Tahoe-LAFS-v1.3 configuration file" in str(m[0][0]) and oldfile in str(m[0][0])) ]
|
||||||
|
self.failUnless(logged, (oldfile, mock_log_msg.call_args_list))
|
||||||
|
|
||||||
for oldfile in [
|
for oldfile in [
|
||||||
'nickname', 'webport', 'keepalive_timeout', 'log_gatherer.furl',
|
'nickname', 'webport', 'keepalive_timeout', 'log_gatherer.furl',
|
||||||
'disconnect_timeout', 'advertised_ip_addresses', 'helper.furl',
|
'disconnect_timeout', 'advertised_ip_addresses', 'helper.furl',
|
||||||
'key_generator.furl', 'stats_gatherer.furl', 'sizelimit',
|
'key_generator.furl', 'stats_gatherer.furl', 'sizelimit',
|
||||||
'run_helper']:
|
'run_helper']:
|
||||||
warned = [ m for m in mocklogerr.call_args_list if ("Found pre-Tahoe-LAFS-v1.3 configuration file" in m[0][0] and oldfile in m[0][0]) ]
|
logged = [ m for m in mock_log_msg.call_args_list if
|
||||||
self.failIf(warned, oldfile)
|
("Found pre-Tahoe-LAFS-v1.3 configuration file" in str(m[0][0]) and oldfile in str(m[0][0])) ]
|
||||||
|
self.failIf(logged, oldfile)
|
||||||
|
|
||||||
def test_secrets(self):
|
def test_secrets(self):
|
||||||
basedir = "test_client.Basic.test_secrets"
|
basedir = "test_client.Basic.test_secrets"
|
||||||
|
Loading…
Reference in New Issue
Block a user