Skip to content

Commit

Permalink
[Fixes #12657] Refactor supported type, fix data retriever and refact…
Browse files Browse the repository at this point in the history
…or handlers configuration
  • Loading branch information
mattiagiupponi committed Oct 18, 2024
1 parent 88770fc commit 005a00d
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 20 deletions.
4 changes: 1 addition & 3 deletions geonode/resource/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,7 @@ def test_endpoint_should_raise_error_if_pk_is_not_passed(self):

def test_endpoint_should_return_the_source(self):
# creating dummy execution request
obj = ExecutionRequest.objects.create(
user=self.superuser, func_name="import_new_resource", action="upload", source="upload_workflow"
)
obj = ExecutionRequest.objects.create(user=self.superuser, func_name="import_new_resource", action="upload")
self.client.force_login(self.superuser)

_url = f"{reverse('executionrequest-list')}/{obj.exec_id}"
Expand Down
2 changes: 0 additions & 2 deletions geonode/resource/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,3 @@ class ExecutionRequest(models.Model):
action = models.CharField(
max_length=50, choices=ACTION_CHOICES, default=ExecutionRequestAction.UNKNOWN.value, null=True
)

source = models.CharField(max_length=250, null=True, default=None)
4 changes: 1 addition & 3 deletions geonode/security/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,9 +752,7 @@ def test_dataset_permissions(self):
bobby = get_user_model().objects.get(username="bobby")

self.client.force_login(get_user_model().objects.get(username="admin"))
payload = {
"base_file": open(f"{project_dir}/tests/fixture/valid.geojson", "rb"),
}
payload = {"base_file": open(f"{project_dir}/tests/fixture/valid.geojson", "rb"), "action": "upload"}
response = self.client.post(reverse("importer_upload"), data=payload)
layer = ResourceHandlerInfo.objects.filter(execution_request=response.json()["execution_id"]).first().resource
if layer is None:
Expand Down
1 change: 0 additions & 1 deletion geonode/upload/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ def copy(self, request, *args, **kwargs):
**{"handler_module_path": handler_module_path},
**extracted_params,
},
source="importer_copy",
)

sig = import_orchestrator.s(
Expand Down
4 changes: 1 addition & 3 deletions geonode/upload/handlers/remote/tests/test_wms.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ class TestRemoteWMSResourceHandler(TestCase):
def setUpClass(cls):
super().setUpClass()
cls.handler = RemoteWMSResourceHandler()
cls.valid_url = (
"https://development.demo.geonode.org/geoserver/ows?service=WMS&version=1.3.0&request=GetCapabilities"
)
cls.valid_url = "http://geoserver:8080/geoserver/ows?service=WMS&version=1.3.0&request=GetCapabilities"
cls.user, _ = get_user_model().objects.get_or_create(username="admin")
cls.invalid_payload = {
"url": "http://invalid.com",
Expand Down
2 changes: 1 addition & 1 deletion geonode/upload/handlers/tiles3d/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def test_supported_file_extension_config(self):
"required_ext": ["zip"],
}
],
"actions": list(self.TASKS.keys()),
"actions": list(Tiles3DFileHandler.TASKS.keys()),
"type": "vector",
}
actual = self.handler.supported_file_extension_config
Expand Down
1 change: 0 additions & 1 deletion geonode/upload/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ def create_execution_request(
input_params=input_params,
action=action,
name=name,
source=source,
)
return execution.exec_id

Expand Down
6 changes: 2 additions & 4 deletions geonode/upload/tests/end2end/test_end2end.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,11 @@ class ImporterWMSImportTest(BaseImporterEndToEndTest):
@mock.patch.dict(os.environ, {"GEONODE_GEODATABASE": "test_geonode_data", "ASYNC_SIGNALS": "False"})
@override_settings(GEODATABASE_URL=f"{geourl.split('/geonode_data')[0]}/test_geonode_data", ASYNC_SIGNALS=False)
def test_import_wms(self):
_, wms = WebMapService(
"https://development.demo.geonode.org/geoserver/ows?service=WMS&version=1.3.0&request=GetCapabilities"
)
_, wms = WebMapService("http://geoserver:8080/geoserver/ows?service=WMS&version=1.3.0&request=GetCapabilities")
resource_to_take = next(iter(wms.contents))
res = wms[next(iter(wms.contents))]
payload = {
"url": "https://development.demo.geonode.org/geoserver/ows?service=WMS&version=1.3.0&request=GetCapabilities",
"url": "http://geoserver:8080/geoserver/ows?service=WMS&version=1.3.0&request=GetCapabilities",
"title": "Remote Title",
"type": "wms",
"lookup": resource_to_take,
Expand Down
2 changes: 0 additions & 2 deletions geonode/upload/tests/unit/test_dastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def setUp(self):
input_params={
**{"handler_module_path": "geonode.upload.handlers.gpkg.handler.GPKGFileHandler"},
},
source="importer_copy",
)
self.datastore = DataStoreManager(
self.files, "geonode.upload.handlers.gpkg.handler.GPKGFileHandler", self.user, execution_id
Expand All @@ -53,7 +52,6 @@ def setUp(self):
step="create",
action="upload",
input_params={"url": "https://geosolutionsgroup.com"},
source="importer_copy",
)
self.datastore_url = DataStoreManager(
self.files, "geonode.upload.handlers.common.remote.BaseRemoteResourceHandler", self.user, execution_id_url
Expand Down

0 comments on commit 005a00d

Please sign in to comment.