Skip to content

Commit

Permalink
Fix tests about urlencode
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Sep 23, 2024
1 parent 40cad6d commit 472488d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lizmap_server/get_feature_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def feature_list_to_replace(
project: QgsProject,
relation_manager: QgsRelationManager,
xml: str,
bootstrap_5: bool
bootstrap_5: bool,
) -> List[Result]:
""" Parse the XML and check for each layer according to the Lizmap CFG file. """
features = []
Expand Down
2 changes: 1 addition & 1 deletion test/test_get_feature_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def test_single_get_feature_info_ascii(client):
"FILTER": "accents:\"NAME_1\" = 'Bret\\'agne'",
}

rv = client.get(_build_query_string(qs, use_urllib3=True), PROJECT)
rv = client.get(_build_query_string(qs, use_urllib=True), PROJECT)
data = _check_request(rv)

if Qgis.QGIS_VERSION_INT <= 31700:
Expand Down
8 changes: 4 additions & 4 deletions test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from PIL import Image
from qgis.server import QgsBufferServerResponse
from urllib3 import request
from urllib.parse import urlencode

__copyright__ = 'Copyright 2024, 3Liz'
__license__ = 'GPL version 3'
Expand Down Expand Up @@ -58,10 +58,10 @@ def xpath_text(self, path: str) -> str:
return ' '.join(e.text for e in self.xpath(path))


def _build_query_string(params: dict, use_urllib3: bool=False) -> str:
def _build_query_string(params: dict, use_urllib: bool = False) -> str:
""" Build a query parameter from a dictionary. """
if use_urllib3:
return "?" + request.urlencode(params)
if use_urllib:
return "?" + urlencode(params)

query_string = '?'
for k, v in params.items():
Expand Down

0 comments on commit 472488d

Please sign in to comment.