mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-07 18:44:07 +00:00
adapt unit tests to use separate interpolation table
This commit is contained in:
@@ -76,8 +76,8 @@ def test_analyse_indexing_with_osm_id(project_env, placex_row):
|
||||
class TestAdminCleanDeleted:
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup_polygon_delete(self, project_env, table_factory, place_table, placex_row,
|
||||
osmline_table, temp_db_cursor, load_sql):
|
||||
def setup_polygon_delete(self, project_env, table_factory, place_interpolation_table,
|
||||
placex_row, osmline_table, temp_db_cursor, load_sql):
|
||||
""" Set up place_force_delete function and related tables
|
||||
"""
|
||||
self.project_env = project_env
|
||||
@@ -106,16 +106,24 @@ class TestAdminCleanDeleted:
|
||||
class TEXT NOT NULL,
|
||||
type TEXT NOT NULL,
|
||||
deferred BOOLEAN""")
|
||||
table_factory('place_interpolation_to_be_deleted',
|
||||
"""osm_id BIGINT,
|
||||
osm_type CHAR(1)""")
|
||||
table_factory('import_polygon_error', """osm_id BIGINT,
|
||||
osm_type CHAR(1),
|
||||
class TEXT NOT NULL,
|
||||
type TEXT NOT NULL""")
|
||||
temp_db_cursor.execute("""CREATE OR REPLACE FUNCTION place_delete()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN RETURN NULL; END;
|
||||
$$ LANGUAGE plpgsql;""")
|
||||
temp_db_cursor.execute("""CREATE TRIGGER place_before_delete BEFORE DELETE ON place
|
||||
FOR EACH ROW EXECUTE PROCEDURE place_delete();""")
|
||||
temp_db_cursor.execute("""
|
||||
CREATE OR REPLACE FUNCTION place_delete() RETURNS TRIGGER AS $$
|
||||
BEGIN RETURN NULL; END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER place_before_delete BEFORE DELETE ON place
|
||||
FOR EACH ROW EXECUTE PROCEDURE place_delete();
|
||||
|
||||
CREATE TRIGGER place_interpolation_before_delete BEFORE DELETE ON place_interpolation
|
||||
FOR EACH ROW EXECUTE PROCEDURE place_delete();
|
||||
""")
|
||||
load_sql('functions/utils.sql')
|
||||
|
||||
def test_admin_clean_deleted_no_records(self):
|
||||
|
||||
@@ -165,12 +165,12 @@ def test_truncate_database_tables(temp_db_conn, temp_db_cursor, table_factory, w
|
||||
|
||||
@pytest.mark.parametrize("threads", (1, 5))
|
||||
@pytest.mark.asyncio
|
||||
async def test_load_data(dsn, place_row, placex_table, osmline_table,
|
||||
async def test_load_data(dsn, place_row, place_interpolation_row, placex_table, osmline_table,
|
||||
temp_db_cursor, threads):
|
||||
for oid in range(100, 130):
|
||||
place_row(osm_id=oid)
|
||||
place_row(osm_type='W', osm_id=342, cls='place', typ='houses',
|
||||
geom='LINESTRING(0 0, 10 10)')
|
||||
place_interpolation_row(osm_type='W', osm_id=342, typ='odd',
|
||||
geom='LINESTRING(0 0, 10 10)')
|
||||
|
||||
temp_db_cursor.execute("""
|
||||
CREATE OR REPLACE FUNCTION placex_insert() RETURNS TRIGGER AS $$
|
||||
@@ -238,7 +238,7 @@ class TestSetupSQL:
|
||||
assert not reverse == temp_db_cursor.table_exists('search_name')
|
||||
|
||||
def test_create_table_triggers(self, temp_db_conn, placex_table, osmline_table,
|
||||
postcode_table, load_sql):
|
||||
place_interpolation_table, postcode_table, load_sql):
|
||||
load_sql('functions.sql')
|
||||
|
||||
database_import.create_table_triggers(temp_db_conn, self.config)
|
||||
|
||||
Reference in New Issue
Block a user