def test_create(self): """Tests the navigator.create function""" con = DbTestCase.connection options = Config.init( ['dbmanagr-c.sqlite/user'], navigator.args.parser) options.show = 'connections' self.assertEqual( [None], navigator.create(None, options)) options.show = 'databases' self.assertEqual( ['dbmanagr-c.sqlite//'], map(str, navigator.create(con, options))) options.database = 'db' self.assertEqual( [], map(str, navigator.create(con, options))) options = Config.init( ['dbmanagr-c.sqlite/user?'], navigator.args.parser) self.assertEqual( ['dbmanagr-c.sqlite/'], map(str, navigator.create(con, options)))
def init(argv, parser): left = Config.init(argv, parser) left.uri = left.left left.update_parsers() right = Config.init(argv, parser) right.uri = right.right right.update_parsers() return (left, right)
def test_options(self): """Tests options""" config = Config.init(['-r', '--database', 'dbmanagr.sqlite/article'], grapher.args.parser) config.database = 'db' self.assertEqual(12, len(grapher.DatabaseGrapher(config).run()))
def test_create_values(self): """Tests the create_values function""" con = DbTestCase.connection user = con.table('user') options = Config.init(['dbmanagr-c.sqlite/user?'], navigator.args.parser) options.simplify = False self.assertIsNotNone(navigator.create_values(con, user, options))
def test_options(self): """Tests options""" config = Config.init( ['-r', '--database', 'dbmanagr.sqlite/article'], grapher.args.parser) config.database = 'db' self.assertEqual( 12, len(grapher.DatabaseGrapher(config).run()))
def main(args=None): if args is None: args = sys.argv[1:] config = Config.init(args, parser) { 'start': start, 'stop': stop, 'restart': restart, 'status': status }.get(config.command)(config)
def test_create_values(self): """Tests the create_values function""" con = DbTestCase.connection user = con.table('user') options = Config.init( ['dbmanagr-c.sqlite/user?'], navigator.args.parser) options.simplify = False self.assertIsNotNone( navigator.create_values(con, user, options) )
def test_create(self): """Tests the navigator.create function""" con = DbTestCase.connection options = Config.init(['dbmanagr-c.sqlite/user'], navigator.args.parser) options.show = 'connections' self.assertEqual([None], navigator.create(None, options)) options.show = 'databases' self.assertEqual(['dbmanagr-c.sqlite//'], map(str, navigator.create(con, options))) options.database = 'db' self.assertEqual([], map(str, navigator.create(con, options))) options = Config.init(['dbmanagr-c.sqlite/user?'], navigator.args.parser) self.assertEqual(['dbmanagr-c.sqlite/'], map(str, navigator.create(con, options)))
def test_filter(self): """Tests the filter function""" self.assertEqual( True, dbc.PostgreSQLConnection( 'uri', 'host', '3333', 'db', 'user', 'password' ).filter_(Config.init(['user@host/db/'], navigator.args.parser))) self.assertEqual( False, dbc.PostgreSQLConnection( 'postgresql+pg8000://{user}:{password}@{host}/{database}', 'host', '3333', 'db', 'user', 'password' ).filter_({'postgresql': Opts(user='******', host=None)}))
def execute(args): """ Directly calls the execute method and avoids using the wrapper """ return DatabaseExporter(Config.init(args, parser)).execute()
def main(args=None): if args is None: args = sys.argv[1:] return DatabaseExporter(Config.init(args, parser)).write()
def run(args): return DatabaseExporter(Config.init(args, parser)).run()
def test_trace(self): """Tests the trace option""" self.assertEqual(True, Config.init(['--trace'], navigator.args.parser).trace)
def run(args): return DatabaseStatus(Config.init(args, parser)).run()
def run(args): return DatabaseGrapher(Config.init(args, parser)).run()
def test_trace(self): """Tests the trace option""" self.assertEqual( True, Config.init(['--trace'], navigator.args.parser).trace)
def run(args): return DatabaseArgumentor(Config.init(args, parser)).run()
def run(args): return DatabaseNavigator(Config.init(args, parser)).run()