def _handle_positional_argument(self, options, argument): ''' Handle the positional arguments from the commandline. ''' if argument == 'start-network': self.handle_network("start") return elif argument == 'stop-network': self.handle_network("stop") return elif argument == 'restart-network': self.handle_network("stop") self.handle_network("start") return config = Config() config.set_from_file(options.config) config.set_from_cmd_line(options) config.print_options() app = OANApplication.create_twisted_circular_node(config) daemon = OANDaemon(app) if argument == 'start': daemon.start() elif argument == 'stop': daemon.stop() elif argument == 'restart': daemon.restart() elif argument == 'native': app.run_server() else: self._parser.print_help()
class TestConfigSetFromFile(TestConfig): def setUp(self): self._config = Config() self._config.set_from_file("./tests/oand.cfg") def test_config_extended(self): cnf = self._config self.assertEqual(cnf.pid_file, self.opts["pid_file"]) self.assertEqual(cnf.log_file, self.opts["log_file"])