def conn(): test_conn = psycopg2.connect(dbname='foursquare_test', user='******', password='******') cursor = test_conn.cursor() db.drop_all_tables(test_conn, cursor) yield test_conn db.drop_all_tables(test_conn, cursor)
def test_conn(): test_conn = psycopg2.connect(dbname=DBTEST_NAME, user=DBTEST_USER, password=DBTEST_PASSWORD) cursor = test_conn.cursor() db.drop_all_tables(test_conn, cursor) # db.reset_all_primarykey(test_conn, cursor) yield test_conn db.drop_all_tables(test_conn, cursor)
def test_conn(): # reference via user and password via .env test_conn = psycopg2.connect(dbname='mobilegaming_test', user='******', password='******') cursor = test_conn.cursor() db.drop_all_tables(test_conn, cursor) db.reset_all_primarykey(test_conn, cursor) yield test_conn db.drop_all_tables(test_conn, cursor) db.reset_all_primarykey(test_conn, cursor)
def db_cursor(): flask_app = create_app('foursquare_test', testing=True, debug=True) with flask_app.app_context(): conn = get_db() cursor = conn.cursor() drop_all_tables(conn, cursor) build_records(conn, cursor) yield cursor with flask_app.app_context(): close_db() conn = get_db() cursor = conn.cursor() drop_all_tables(conn, cursor) close_db()
def app(): flask_app = create_app('mobilegaming_test', testing=True, debug=True) with flask_app.app_context(): conn = db.get_db() cursor = conn.cursor() db.drop_all_tables(conn, cursor) db.reset_all_primarykey(conn, cursor) build_records(conn, cursor) conn.commit() db.close_db() yield flask_app with flask_app.app_context(): db.close_db() conn = db.get_db() cursor = conn.cursor() db.drop_all_tables(conn, cursor) db.reset_all_primarykey(conn, cursor) db.close_db()