Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions geonode/upload/handlers/remote/tests/test_wms.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#
#########################################################################
from collections import namedtuple
from urllib.parse import ParseResult
from django.test import TestCase
from mock import MagicMock, patch
from geonode.upload.api.exceptions import ImportException
Expand Down Expand Up @@ -133,7 +134,7 @@ def test_prepare_import_should_not_update_the_execid(self, remote_wms):
prepare_import should update the execid
if the parse_remote_metadata is False
"""
fake_url = MagicMock(shema="http", netloc="fake", path="foo", query="bar")
fake_url = ParseResult(scheme="http", netloc="fake", path="/foo", params="", query="bar", fragment="")
remote_wms.get_cleaned_url_params.return_value = fake_url, None, None, None

try:
Expand Down Expand Up @@ -165,7 +166,7 @@ def test_prepare_import_should_update_the_execid(self, get_wms_resource, remote_
if the parse_remote_metadata is True
"""
# remote_wms = MagicMock(title="updated_title", bbox=[1,2,3,4])
fake_url = MagicMock(shema="http", netloc="fake", path="foo", query="bar")
fake_url = ParseResult(scheme="http", netloc="fake", path="/foo", params="", query="bar", fragment="")
remote_wms.get_cleaned_url_params.return_value = fake_url, None, None, None

obj = namedtuple("WmsObj", field_names=["title", "boundingBoxWGS84"])
Expand Down
4 changes: 3 additions & 1 deletion geonode/upload/handlers/remote/wms.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ def prepare_import(self, files, execution_id, **kwargs):
"""
_exec = orchestrator.get_execution_object(exec_id=execution_id)
cleaned_url, _, _, _ = WmsServiceHandler.get_cleaned_url_params(_exec.input_params.get("url"))

parsed_url = f"{cleaned_url.scheme}://{cleaned_url.netloc}{cleaned_url.path}"
ows_url = f"{parsed_url}?{cleaned_url.query}"
ows_url = cleaned_url._replace(params="", fragment="").geturl()

to_update = {
"ows_url": ows_url,
"parsed_url": parsed_url,
Expand Down
Loading