Exemplo n.º 1
0
def setup_db():
    proc = subprocess.Popen(
        ["mysql", "--user=%s" % DB_CONFIG["user"], "--password=%s" % DB_CONFIG["passwd"], DB_CONFIG["db"]],
        stdin=subprocess.PIPE,
        stdout=subprocess.PIPE,
    )
    with open(SQL_DUMP, "rb") as f:
        out, err = proc.communicate(f.read())

    db.gen_queries(QUERY_FILE, DB_CONFIG)
Exemplo n.º 2
0
    def test_gen_queries(self):
        db.gen_queries(QUERY_FILE, DB_CONFIG)

        assert (
            hasattr(db, "create_user")
            and hasattr(db, "get_user")
            and hasattr(db, "get_users")
            and hasattr(db, "update_user")
            and hasattr(db, "update_user_pw")
            and hasattr(db, "delete_user")
        )