Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests - Upgrade existing tests to QGIS 3.22 with POST #446

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions QuickOSM/test/test_processing_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,8 @@ def test_process_raw_query(self):
"""Test for the process algorithm from a raw query."""
handler = SequentialHandler()
handler.add(
'GET',
"/interpreter?data=[out:xml]%20[timeout:25];%0A%20area(3600028722)%20-%3E%20.area_0;"
"%0A(%0A%20%20%20%20node[%22amenity%22%3D%22bench%22](area.area_0);%0A%20%20%20%20way"
"[%22amenity%22%3D%22bench%22](area.area_0);%0A%20%20%20%20relation[%22amenity%22%3D%22bench%22]"
"(area.area_0);%0A);%0A(._;%3E;);%0Aout%20body;&info=QgisQuickOSMPlugin",
'POST',
"/interpreter?info=QgisQuickOSMPlugin",
200,
{'Content-type': 'text/xml'},
open(plugin_test_data_path('overpass', 'empty_osm_file.xml'), 'r', encoding='utf8').read(),
Expand All @@ -68,7 +65,7 @@ def test_process_raw_query(self):
'relation[\"amenity\"=\"bench\"](area.area_0);\n);\n'
'(._;>;);\nout body;',
'TIMEOUT': 25,
'SERVER': 'http://localhost:{}/interpreter'.format(self.port),
'SERVER': f'http://localhost:{self.port}/interpreter',
'EXTENT': '3.809971100,3.963647400,43.557942300,43.654612100 [EPSG:4326]',
'AREA': '',
'FILE': ''
Expand All @@ -84,7 +81,7 @@ def test_process_not_spatial_query(self):
"""Test for the process algorithm from a not spatial query."""
handler = SequentialHandler()
handler.add(
'GET',
'POST',
'/interpreter?data=[out:xml]%20[timeout:25];%0A(%0A%20%20%20%20node[%22amenity%22%3D%22foo%22];'
'%0A%20%20%20%20way[%22amenity%22%3D%22foo%22];%0A%20%20%20%20relation[%22amenity%22%3D%22foo%22]'
';%0A);%0A(._;%3E;);%0Aout%20body;&info=QgisQuickOSMPlugin',
Expand Down Expand Up @@ -112,7 +109,7 @@ def test_process_in_query(self):
"""Test for the process algorithm from an 'in' query."""
handler = SequentialHandler()
handler.add(
'GET',
'POST',
'/interpreter?data=[out:xml]%20[timeout:25];%0A%20area(3600118810)%20-%3E%20.area_0;%0A'
'(%0A%20%20%20%20node[%22amenity%22%3D%22bench%22](area.area_0);%0A%20%20%20%20way[%22amenity'
'%22%3D%22bench%22](area.area_0);%0A%20%20%20%20relation[%22amenity%22%3D%22bench%22]'
Expand Down Expand Up @@ -142,7 +139,7 @@ def test_process_around_query(self):
"""Test for the process algorithm from an 'around' query."""
handler = SequentialHandler()
handler.add(
'GET',
'POST',
'/interpreter?data=[out:xml]%20[timeout:25];%0A(%0A%20%20%20%20node[%22amenity%22%3D%22bench%22]'
'(around:1500,%2046.2383347,1.4861387);%0A%20%20%20%20way[%22amenity%22%3D%22bench%22]'
'(around:1500,%2046.2383347,1.4861387);%0A%20%20%20%20relation[%22amenity%22%3D%22bench%22]'
Expand All @@ -158,7 +155,7 @@ def test_process_around_query(self):
'AREA': 'La Souterraine',
'DISTANCE': 1500,
'KEY': 'amenity',
'SERVER': 'http://localhost:{}/interpreter'.format(self.port),
'SERVER': f'http://localhost:{self.port}/interpreter',
'TIMEOUT': 25,
'VALUE': 'bench'
}
Expand All @@ -173,7 +170,7 @@ def test_process_extent_query(self):
"""Test for the process algorithm from an 'extent' query."""
handler = SequentialHandler()
handler.add(
'GET',
'POST',
'/interpreter?data=[out:xml]%20[timeout:25];%0A(%0A%20%20%20%20node[%22amenity%22%3D%22bench%22]'
'(%2043.55794,3.80997,43.65461,3.96364);%0A%20%20%20%20way[%22amenity%22%3D%22bench%22]'
'(%2043.55794,3.80997,43.65461,3.96364);%0A%20%20%20%20relation[%22amenity%22%3D%22bench%22]'
Expand All @@ -188,7 +185,7 @@ def test_process_extent_query(self):
{
'EXTENT': '3.809971100,3.963647400,43.557942300,43.654612100 [EPSG:4326]',
'KEY': 'amenity',
'SERVER': 'http://localhost:{}/interpreter'.format(self.port),
'SERVER': f'http://localhost:{self.port}/interpreter',
'TIMEOUT': 25,
'VALUE': 'bench'
}
Expand All @@ -201,11 +198,11 @@ def test_process_extent_query(self):

def test_reprojection_extent_query(self):
"""Test for the reprojection from the project CRS."""
# In processing.run, we can see some 2154 coordinates.
# In the query, coordinates in 4326
# In processing.run, we can see some EPSG:2154 coordinates.
# In the query, coordinates are in EPSG:4326
handler = SequentialHandler()
handler.add(
'GET',
'POST',
'/interpreter?data=[out:xml]%20[timeout:25];%0A(%0A%20%20%20%20node[%22landuse%22]'
'(%2045.0843,-0.3832,45.09649,-0.36385);%0A%20%20%20%20way[%22landuse%22]'
'(%2045.0843,-0.3832,45.09649,-0.36385);%0A%20%20%20%20relation[%22landuse%22]'
Expand All @@ -227,7 +224,7 @@ def test_reprojection_extent_query(self):
'VALUE': '',
'EXTENT': '433888.4776000,435466.5863000,6448484.3786000,6449771.2615000 [EPSG:2154]',
'TIMEOUT': 25,
'SERVER': 'http://localhost:{}/interpreter'.format(self.port),
'SERVER': f'http://localhost:{self.port}/interpreter',
},
context=context
)
Expand Down