예제 #1
0
def main():
    logging.basicConfig(level=logging.INFO)

    if Settings.testing_urls_available:
        pass

    parser = argparse.ArgumentParser(description='Admin util for SLAMon Agent Fleet Manager')
    subparsers = parser.add_subparsers()

    run_parser = subparsers.add_parser('run', help='Run AFM', description='Run an instance of an Agent Fleet Manager '
                                                                          'that listens to given host address')
    run_parser.add_argument('host', help='Host name or address e.g. localhost or 127.0.0.1', action='store')
    run_parser.set_defaults(func=run_afm)

    create_parser = subparsers.add_parser('create-tables', help='Create SQL tables',
                                          description='Create required database tables to PostgreSQL')
    create_parser.set_defaults(func=create)

    drop_parser = subparsers.add_parser('drop-tables', help='Drop SQL tables',
                                        description='Drop created database tables from PostgreSQL')
    drop_parser.set_defaults(func=drop)

    init_connection(unittest=False)

    args = parser.parse_args()
    args.func(args)
예제 #2
0
    def setup(self):
        init_connection(unittest=True)

        self.create_tables()
    def test_status_broken_session():
        test_app = TestApp(app)
        os.environ['OPENSHIFT_POSTGRESQL_DB_URL'] = 'postgresql+psycopg2://slamon:slamon@localhost/whatever'
        init_connection()

        assert test_app.get('/status', expect_errors=True).status_int == 500