mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-08 11:24:25 +00:00
tests to cover config changes
This commit is contained in:
parent
6c388b9d58
commit
dd2209a96c
@ -41,6 +41,11 @@ class Node(testutil.SignalMixin, testutil.ReallyEqualMixin, unittest.TestCase):
|
||||
from allmydata.introducer import IntroducerNode
|
||||
IntroducerNode # pyflakes
|
||||
|
||||
def test_create(self):
|
||||
basedir = "introducer.IntroducerNode.test_create"
|
||||
create_introducer(basedir)
|
||||
self.assertTrue(os.path.exists(basedir))
|
||||
|
||||
def test_furl(self):
|
||||
basedir = "introducer.IntroducerNode.test_furl"
|
||||
create_node_dir(basedir, "testing")
|
||||
|
@ -137,6 +137,44 @@ class TestCase(testutil.SignalMixin, unittest.TestCase):
|
||||
config = read_config(basedir, "")
|
||||
self.failUnless(config.nickname == nickname)
|
||||
|
||||
def test_config_required(self):
|
||||
basedir = u"test_node/test_config_required"
|
||||
config = read_config(basedir, "portnum")
|
||||
|
||||
with self.assertRaises(Exception) as ctx:
|
||||
config.get_config_from_file("it_does_not_exist", required=True)
|
||||
|
||||
def test_private_config_unreadable(self):
|
||||
basedir = u"test_node/test_private_config_unreadable"
|
||||
create_node_dir(basedir, "testing")
|
||||
config = read_config(basedir, "portnum")
|
||||
config.get_or_create_private_config("foo", "contents")
|
||||
fname = os.path.join(basedir, "private", "foo")
|
||||
os.chmod(fname, 0)
|
||||
|
||||
with self.assertRaises(Exception) as ctx:
|
||||
config.get_or_create_private_config("foo")
|
||||
|
||||
def test_private_config_unreadable_preexisting(self):
|
||||
basedir = u"test_node/test_private_config_unreadable_preexisting"
|
||||
create_node_dir(basedir, "testing")
|
||||
config = read_config(basedir, "portnum")
|
||||
fname = os.path.join(basedir, "private", "foo")
|
||||
with open(fname, "w") as f:
|
||||
f.write("stuff")
|
||||
os.chmod(fname, 0)
|
||||
|
||||
with self.assertRaises(Exception) as ctx:
|
||||
config.get_private_config("foo")
|
||||
|
||||
def test_private_config_missing(self):
|
||||
basedir = u"test_node/test_private_config_missing"
|
||||
create_node_dir(basedir, "testing")
|
||||
config = read_config(basedir, "portnum")
|
||||
|
||||
with self.assertRaises(MissingConfigEntry) as ctx:
|
||||
config.get_or_create_private_config("foo")
|
||||
|
||||
def test_private_config(self):
|
||||
basedir = "test_node/test_private_config"
|
||||
privdir = os.path.join(basedir, "private")
|
||||
|
Loading…
x
Reference in New Issue
Block a user