def test_hoogteview():

    sql = sql_utils.SQLRunner()

    for hoogte in ('_2', '_1', '0', '1', '2'):
        exists = sql.run_sql(
            f"select exists(select count(*) from bgt.spoor_lijn{hoogte})")
        assert exists[0][0]
Beispiel #2
0
def checktable(table, checkcolumns):
    """

    :param table:
    :param checkcolumns:
    :return:
    """
    sql = sql_utils.SQLRunner()
    foundcolumns = sql.get_columns_from_table(table)
    assert len(foundcolumns) == len(checkcolumns)
    result = [col for col in checkcolumns if col in foundcolumns]
    assert len(result) == len(checkcolumns)
def test_create_indexes():
    """
    Check that EVERY table has a 'gist' index
    """

    sql = sql_utils.SQLRunner()

    table_and_view_names = [
        "BGT_PND_pand",
        "BGT_OBW_opslagtank",
        "BGT_SPR_sneltram",
        "BGT_OBW_overkapping",
        "BGT_SPR_tram",
        "BGT_SPR_trein",
        "spoor_lijn1",
        "spoor_lijn_2",
        "spoor_lijn_1",
        "gebouw_vlak0",
        "spoor_lijn0",
        "spoor_lijn2",
        "gebouw_vlak1",
        "WDL_breed_water",
        "KRT_topografie",
        "KRT_brug_viaduct",
        "KRT_A_wegnummer_bord",
        "KBK25_LBL_gemeente",
        "KBK25_LBL_park",
        "KBK25_LBL_kunstwerk",
        "KBK25_LBL_gebied",
    ]

    indexen = sql.run_sql("""
        SELECT tablename, indexname FROM pg_indexes
        WHERE indexname NOT LIKE 'pg%'
        AND indexname LIKE '%_gist';
        """)
    assert len(indexen) == 17

    for row in indexen:
        assert row[0] in table_and_view_names