コード例 #1
0
ファイル: test_login.py プロジェクト: cowboygneox/gandalf
    def get_app(self):
        conn = psycopg2.connect(host="localhost", user="******")
        cursor = conn.cursor()
        cursor.execute("DROP SCHEMA IF EXISTS gandalf CASCADE")
        conn.commit()

        app = make_app(GandalfConfiguration('localhost:8889', PostgresAdapter(), 'localhost'))
        app.listen(8888)
        return app
コード例 #2
0
def tst(session):
    os.environ["APPLICATION_ENV"] = "testing"
    application = make_app()
    session.client = application.test_client()
    session.context = application.test_request_context()
    with application.app_context():
        connection.connect(application.config["MONGO_URL"])
        yield session
    client = connection._get_connection().database.client
    client.drop_database(application.config["MONGO_DB"])
コード例 #3
0
import sys
from sqlalchemy.sql.functions import func
from run import make_app
from iggybase.database import db_session
from iggybase.mod_admin.models import *
from iggybase.mod_admin import models as adm_mods

app = make_app()        
sess = db_session        ## shorthand.


def input_role(where):
    """Get from or to role from the customer.
    """
    print()
    print('Which role to copy %s?' % where)
    for index, role in enumerate(roles):
        print(index+1, role.name)
    ans = input('1 - %d, which? ' % len(roles))
    try:
        role = roles[int(ans) - 1]
    except:
        print('Wrong answer. Frown....')
        sys.exit()
    return role

def do_you_want_message(from_role, to_role, role_models):
    print()
    msg = """Records from %s from the following tables will be duped 
to the role %s:""" \
        % (from_role.name, to_role.name)