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

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

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