def delete_test_database_and_user(db_name, username, config):
    try:
        pgcd.delete_database(db_name, config)
    except ValueError as e:
        pass
        # print(ValueError(e.args[0]))
    try:
        pgcd.delete_user(username, config)
    except ValueError as e:
        pass
示例#2
0
def delete_all_test_database_and_user(config):
    con = pgcd._create_pg_connection(config)
    cur = con.cursor()
    cur.execute('''SELECT d.datname, u.usename
           FROM pg_database d
           JOIN pg_user u ON (d.datdba = u.usesysid);''')
    for db in cur:
        if db[0].startswith("tests_postgraas_"):
            delete_test_database_and_user(db[0], db[1], config)
    cur.execute('''SELECT u.usename
           FROM pg_user u;''')
    for db in cur:
        if db[0].startswith("tests_postgraas_"):
            pgcd.delete_user(db[0], config)
def delete_test_database_and_user(db_name, username, config):
    pgcd.delete_database(db_name, config)
    pgcd.delete_user(username, config)
def delete_test_database_and_user(db_name, username, config):
    pgcd.delete_database(db_name, config)
    pgcd.delete_user(username, config)