Skip to content

Commit

Permalink
[Fixes #261] fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiagiupponi committed Jul 29, 2024
1 parent 0bb8ee2 commit 89a7bf1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM geonode/geonode-base:latest-ubuntu-22.04
RUN rm -rf /usr/src/geonode
RUN git clone https://github.com/GeoNode/geonode.git /usr/src/geonode
RUN cd /usr/src/geonode && git fetch --all && git checkout remote_resource_handler && cd -
RUN cd /usr/src/geonode && git fetch --all && git checkout remote_importer && cd -
RUN mkdir -p /usr/src/importer

RUN cd ..
Expand Down
22 changes: 10 additions & 12 deletions importer/tests/end2end/test_end2end.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
import ast
import os
import time
from uuid import uuid4

import mock
from django.conf import settings
from django.contrib.auth import get_user_model
from django.test import override_settings
from django.urls import reverse
from dynamic_models.models import FieldSchema, ModelSchema
import requests
from geonode.layers.models import Dataset
from geonode.resource.models import ExecutionRequest
from geonode.utils import OGC_Servers_Handler
from geoserver.catalog import Catalog
from importer import project_dir
from importer.publisher import DataPublisher
from importer.tests.utils import ImporterBaseTestSupport
import gisdata
from geonode.base.populate_test_data import create_single_dataset
from django.db.models import Q
from geonode.base.models import ResourceBase
from geonode.resource.manager import resource_manager
import logging
from geonode.harvesting.harvesters.wms import WebMapService
from geonode.services.serviceprocessors.wms import WmsServiceHandler

logger = logging.getLogger()
geourl = settings.GEODATABASE_URL
Expand Down Expand Up @@ -134,6 +129,7 @@ def _assertimport(

if assert_payload:
target = resource.first()
target.refresh_from_db()
for key, value in assert_payload.items():
if hasattr(target, key):
self.assertEqual(getattr(target, key), value)
Expand Down Expand Up @@ -465,9 +461,10 @@ def test_import_raster_overwrite(self):


class Importer3dTilesImportTest(BaseImporterEndToEndTest):
@mock.patch.dict(os.environ, {"GEONODE_GEODATABASE": "test_geonode_data"})
@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"
GEODATABASE_URL=f"{geourl.split('/geonode_data')[0]}/test_geonode_data",
ASYNC_SIGNALS=False
)
def test_import_3dtiles(self):
payload = {
Expand All @@ -485,12 +482,12 @@ def test_import_3dtiles(self):
payload, initial_name, skip_geoserver=True, assert_payload=assert_payload
)

@mock.patch.dict(os.environ, {"GEONODE_GEODATABASE": "test_geonode_data"})
@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"
GEODATABASE_URL=f"{geourl.split('/geonode_data')[0]}/test_geonode_data",
ASYNC_SIGNALS=False
)
def test_import_3dtiles_overwrite(self):

payload = {
"url": "https://raw.githubusercontent.com/CesiumGS/3d-tiles-samples/main/1.1/TilesetWithFullMetadata/tileset.json",
"title": "Remote Title",
Expand Down Expand Up @@ -528,9 +525,10 @@ def test_import_3dtiles_overwrite(self):


class ImporterWMSImportTest(BaseImporterEndToEndTest):
@mock.patch.dict(os.environ, {"GEONODE_GEODATABASE": "geonode_data"})
@mock.patch.dict(os.environ, {"GEONODE_GEODATABASE": "test_geonode_data", "ASYNC_SIGNALS": "False"})
@override_settings(
GEODATABASE_URL=f"{geourl.split('/geonode_data')[0]}/geonode_data"
GEODATABASE_URL=f"{geourl.split('/geonode_data')[0]}/test_geonode_data",
ASYNC_SIGNALS=False
)
def test_import_wms(self):
_, wms = WebMapService(
Expand Down
2 changes: 1 addition & 1 deletion importer/tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.core.management import call_command
from django.test import TestCase, TransactionTestCase
from django.test import TestCase, TransactionTestCase, override_settings


class ImporterBaseTestSupport(TestCase):
Expand Down

0 comments on commit 89a7bf1

Please sign in to comment.