def test_create_loading_table_creates_table(postgres): postgres_conn_id = POSTGRES_CONN_ID identifier = TEST_ID load_table = TEST_LOAD_TABLE sql.create_loading_table(postgres_conn_id, identifier) check_query = (f"SELECT EXISTS (" f"SELECT FROM pg_tables WHERE tablename='{load_table}');") postgres.cursor.execute(check_query) check_result = postgres.cursor.fetchone()[0] assert check_result
def test_create_loading_table_errors_if_run_twice_with_same_id(postgres): postgres_conn_id = POSTGRES_CONN_ID identifier = TEST_ID sql.create_loading_table(postgres_conn_id, identifier) with pytest.raises(Exception): sql.create_loading_table(postgres_conn_id, identifier)