keep clientdir for now, improve how we access it

This commit is contained in:
meejah 2018-02-28 11:13:54 -07:00
parent 2937c729e3
commit 4d7f8ec9dd
3 changed files with 8 additions and 3 deletions

View File

@ -193,8 +193,7 @@ class Backup(GridTestMixin, CLITestMixin, StallMixin, unittest.TestCase):
# sneak into the backupdb, crank back the "last checked" # sneak into the backupdb, crank back the "last checked"
# timestamp to force a check on all files # timestamp to force a check on all files
def _reset_last_checked(res): def _reset_last_checked(res):
dbfile = os.path.join(self.get_clientdir(), dbfile = self.get_client_config().get_private_path("backupdb.sqlite")
"private", "backupdb.sqlite")
self.failUnless(os.path.exists(dbfile), dbfile) self.failUnless(os.path.exists(dbfile), dbfile)
bdb = backupdb.get_backupdb(dbfile) bdb = backupdb.get_backupdb(dbfile)
bdb.cursor.execute("UPDATE last_upload SET last_checked=0") bdb.cursor.execute("UPDATE last_upload SET last_checked=0")

View File

@ -400,6 +400,11 @@ class GridTestMixin:
def get_client_config(self, i=0): def get_client_config(self, i=0):
return self.g.clients[i].config return self.g.clients[i].config
def get_clientdir(self, i=0):
# ideally, use something get_client_config() only, we
# shouldn't need to manipulate raw paths..
return self.get_client_config(i).get_config_path()
def get_client(self, i=0): def get_client(self, i=0):
return self.g.clients[i] return self.g.clients[i]

View File

@ -13,9 +13,10 @@ class ConfigUtilTests(GridTestMixin, unittest.TestCase):
def test_config_utils(self): def test_config_utils(self):
self.basedir = "cli/ConfigUtilTests/test-config-utils" self.basedir = "cli/ConfigUtilTests/test-config-utils"
self.set_up_grid(oneshare=True) self.set_up_grid(oneshare=True)
tahoe_cfg = os.path.join(self.get_clientdir(i=0), "tahoe.cfg")
# test that at least one option was read correctly # test that at least one option was read correctly
config = self.get_client_config(i=0) config = configutil.get_config(tahoe_cfg)
self.failUnlessEqual(config.get("node", "nickname"), "client-0") self.failUnlessEqual(config.get("node", "nickname"), "client-0")
# test that set_config can mutate an existing option # test that set_config can mutate an existing option