X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/8c7140d92b7a679ae5ef5bb3655c69bd39b7dfeb..4cc788f69e1191d2dd985aeac143597566529f24:/test/python/api/test_api_polygons_v1.py diff --git a/test/python/api/test_api_polygons_v1.py b/test/python/api/test_api_polygons_v1.py index 6842f791..e4700a95 100644 --- a/test/python/api/test_api_polygons_v1.py +++ b/test/python/api/test_api_polygons_v1.py @@ -2,38 +2,25 @@ # # This file is part of Nominatim. (https://nominatim.org) # -# Copyright (C) 2023 by the Nominatim developer community. +# Copyright (C) 2025 by the Nominatim developer community. # For a full list of authors see the git log. """ Tests for the deletable v1 API call. """ import json import datetime as dt -from pathlib import Path import pytest -import pytest_asyncio -import psycopg2.extras +from fake_adaptor import FakeAdaptor -from fake_adaptor import FakeAdaptor, FakeError, FakeResponse - -import nominatim.api.v1.server_glue as glue -import nominatim.api as napi - -@pytest_asyncio.fixture -async def api(): - api = napi.NominatimAPIAsync(Path('/invalid')) - yield api - await api.close() +import nominatim_api.v1.server_glue as glue class TestPolygonsEndPoint: @pytest.fixture(autouse=True) def setup_deletable_table(self, temp_db_cursor, table_factory, temp_db_with_extensions): - psycopg2.extras.register_hstore(temp_db_cursor) - self.now = dt.datetime.now() self.recent = dt.datetime.now() - dt.timedelta(days=3) @@ -48,13 +35,12 @@ class TestPolygonsEndPoint: errormessage text, prevgeometry geometry(Geometry,4326), newgeometry geometry(Geometry,4326)""", - content=[(345, 'N', 'boundary', 'administrative', - {'name': 'Foo'}, 'xx', self.recent, - 'some text', None, None), - (781, 'R', 'landuse', 'wood', - None, 'ds', self.now, - 'Area reduced by lots', None, None)]) - + content=[(345, 'N', 'boundary', 'administrative', + {'name': 'Foo'}, 'xx', self.recent, + 'some text', None, None), + (781, 'R', 'landuse', 'wood', + None, 'ds', self.now, + 'Area reduced by lots', None, None)]) @pytest.mark.asyncio async def test_polygons_simple(self, api): @@ -76,7 +62,6 @@ class TestPolygonsEndPoint: 'errormessage': 'Area reduced by lots', 'updated': self.now.isoformat(sep=' ', timespec='seconds')}] - @pytest.mark.asyncio async def test_polygons_days(self, api): a = FakeAdaptor() @@ -87,7 +72,6 @@ class TestPolygonsEndPoint: assert [r['osm_id'] for r in results] == [781] - @pytest.mark.asyncio async def test_polygons_class(self, api): a = FakeAdaptor() @@ -98,8 +82,6 @@ class TestPolygonsEndPoint: assert [r['osm_id'] for r in results] == [781] - - @pytest.mark.asyncio async def test_polygons_reduced(self, api): a = FakeAdaptor()