示例#1
0
    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)))
示例#2
0
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)
示例#3
0
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)
示例#4
0
    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()))
示例#5
0
    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))
示例#6
0
    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()))
示例#7
0
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)
示例#8
0
    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)
        )
示例#9
0
    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)}))
示例#11
0
def execute(args):
    """
    Directly calls the execute method and avoids using the wrapper
    """
    return DatabaseExporter(Config.init(args, parser)).execute()
示例#12
0
def main(args=None):
    if args is None:
        args = sys.argv[1:]
    return DatabaseExporter(Config.init(args, parser)).write()
示例#13
0
def run(args):
    return DatabaseExporter(Config.init(args, parser)).run()
示例#14
0
def execute(args):
    """
    Directly calls the execute method and avoids using the wrapper
    """
    return DatabaseExporter(Config.init(args, parser)).execute()
示例#15
0
    def test_trace(self):
        """Tests the trace option"""

        self.assertEqual(True,
                         Config.init(['--trace'], navigator.args.parser).trace)
示例#16
0
def run(args):
    return DatabaseStatus(Config.init(args, parser)).run()
示例#17
0
def run(args):
    return DatabaseGrapher(Config.init(args, parser)).run()
示例#18
0
def run(args):
    return DatabaseExporter(Config.init(args, parser)).run()
示例#19
0
def main(args=None):
    if args is None:
        args = sys.argv[1:]
    return DatabaseExporter(Config.init(args, parser)).write()
示例#20
0
    def test_trace(self):
        """Tests the trace option"""

        self.assertEqual(
            True,
            Config.init(['--trace'], navigator.args.parser).trace)
示例#21
0
def run(args):
    return DatabaseArgumentor(Config.init(args, parser)).run()
示例#22
0
def run(args):
    return DatabaseNavigator(Config.init(args, parser)).run()
示例#23
0
def run(args):
    return DatabaseGrapher(Config.init(args, parser)).run()
示例#24
0
def run(args):
    return DatabaseNavigator(Config.init(args, parser)).run()