Example #1
0
    def create_app(self):

        # pass in test configuration
        app = create_app()
        app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///testdb.sqlite"
        app.config["TESTING"] = True
        app.config["EXTRANET_ACCOUNT_ID"] = None
        return app
Example #2
0
def app():
    """Session-wide test `Flask` application."""
    settings_override = {
        'TESTING': True,
        'SQLALCHEMY_DATABASE_URI': TEST_DATABASE_URI,
        'WTF_CSRF_ENABLED': False,
        'BCRYPT_LOG_ROUNDS': 4
    }
    app = create_app()
    app.config.update(settings_override)

    with app.app_context():
        db.init_app(app)
        db.create_all()
        auth.init_admin(app)

        yield app

        os.close(TESTDB_FD)
        os.unlink(TESTDB_PATH)
def app():
    """Session-wide test `Flask` application."""
    settings_override = {
        "TESTING": True,
        "SQLALCHEMY_DATABASE_URI": TEST_DATABASE_URI,
        "WTF_CSRF_ENABLED": False,
        "BCRYPT_LOG_ROUNDS": 4,
    }
    app = create_app()
    app.config.update(settings_override)

    with app.app_context():
        db.init_app(app)
        db.create_all()
        auth.init_admin(app)

        yield app

        db.session.remove()
        db.session.close()
        os.unlink(TESTDB_PATH)
Example #4
0
#! /usr/bin/env python
import os
import collectives

if __name__ == "__main__":
    # Systematic upgrade of the db
    os.environ["FLASK_APP"] = "collectives:create_app"
    os.system("flask db upgrade")
    collectives.create_app().run(debug=True)
Example #5
0
    def create_app(self):

        # pass in test configuration
        app = create_app()
        return app
Example #6
0

if __name__ == "__main__":

    parser = argparse.ArgumentParser()
    parser.add_argument(
        "-t",
        "--token",
        help=
        "If provided fetch payment information from an existing payline token. Otherwise initiate a new payment",
    )
    parser.add_argument(
        "-r",
        "--refund",
        action="store_true",
        help="If provided attempt to refund the payment",
    )
    args = parser.parse_args()

    app = create_app()
    app.config["SERVER_NAME"] = "localhost"

    with app.app_context():
        payment_token = args.token
        if payment_token is None:
            payment_token = doWebPayment()

        retrieved_details = getPaymentDetails(payment_token)
        if args.refund:
            doRefund(retrieved_details)