def testConfig(self): """ $ ro config \ -r http://calatola.man.poznan.pl/robox/dropbox_accounts/1/ro_containers/2 \ -p d41d8cd98f00b204e9800998ecf8427e \ -b /usr/workspace/Dropbox/myROs \ -n "Graham Klyne" \ -e [email protected] """ ro_utils.resetconfig(ro_test_config.CONFIGDIR) config = ro_utils.readconfig(ro_test_config.CONFIGDIR) self.assertEqual(config["robase"], None) self.assertEqual(config["rosrs_uri"], None) self.assertEqual(config["rosrs_access_token"], None) self.assertEqual(config["username"], None) self.assertEqual(config["useremail"], None) args = [ "ro", "config", "-b", ro_test_config.ROBASEDIR, "-r", ro_test_config.ROSRS_URI, "-t", ro_test_config.ROSRS_ACCESS_TOKEN, "-n", ro_test_config.ROBOXUSERNAME, "-e", ro_test_config.ROBOXEMAIL ] with SwitchStdout(self.outstr): status = ro.runCommand(ro_test_config.CONFIGDIR, ro_test_config.ROBASEDIR, args) assert status == 0 self.assertEqual(self.outstr.getvalue().count("ro config"), 0) config = ro_utils.readconfig(ro_test_config.CONFIGDIR) self.assertEqual(config["robase"], os.path.abspath(ro_test_config.ROBASEDIR)) self.assertEqual(config["rosrs_uri"], ro_test_config.ROSRS_URI) self.assertEqual(config["rosrs_access_token"], ro_test_config.ROSRS_ACCESS_TOKEN) self.assertEqual(config["username"], ro_test_config.ROBOXUSERNAME) self.assertEqual(config["useremail"], ro_test_config.ROBOXEMAIL) return
def setupTestBaseConfig(self, testbase): """ Test helper creates RO config for designated test base directory and returns configuration and base RO storage directories. """ # @@refactor to use method from rocommand configdir = self.getConfigDir(testbase) robasedir = self.getRoBaseDir(testbase) ro_utils.resetconfig(configdir) args = [ "ro", "config", "-b", robasedir, "-r", ro_test_config.ROSRS_URI, "-t", ro_test_config.ROSRS_ACCESS_TOKEN, "-n", ro_test_config.ROBOXUSERNAME, "-e", ro_test_config.ROBOXEMAIL ] with SwitchStdout(self.outstr): status = ro.runCommand(configdir, robasedir, args) assert status == 0 self.assertEqual(self.outstr.getvalue().count("ro config"), 0) return (configdir, robasedir)