Skip to content

Commit

Permalink
Fix GeoNodeMapTest in integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
lucernae committed Jun 8, 2017
1 parent 81ade4c commit e5ae9e2
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 45 deletions.
6 changes: 3 additions & 3 deletions geonode/qgis_server/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
#
#########################################################################

import os
import logging
import os
from shutil import rmtree

from django.db import models
from django.conf import settings
from django.db import models

from geonode import qgis_server
from geonode.layers.models import Layer
Expand Down Expand Up @@ -113,4 +113,4 @@ def delete_qgis_layer(self):
pass


from geonode.qgis_server import signals # noqa: F402.F401
from geonode.qgis_server import signals # noqa: F402,F401
70 changes: 38 additions & 32 deletions geonode/qgis_server/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,33 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#########################################################################
from __future__ import absolute_import

import logging
import shutil
import os
import shutil
from urllib2 import urlopen, quote
from urlparse import urljoin

from django.db.models import signals, ObjectDoesNotExist
from django.dispatch import Signal
from django.core.urlresolvers import reverse
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db.models import ObjectDoesNotExist, signals
from django.dispatch import Signal

from geonode.qgis_server.models import QGISServerLayer
from geonode import qgis_server
from geonode.base.models import Link
from geonode.layers.models import Layer
from geonode.maps.models import Map, MapLayer
from geonode.qgis_server.tasks.update import create_qgis_server_thumbnail
from geonode.qgis_server.gis_tools import set_attributes
from geonode.qgis_server.helpers import tile_url
from geonode.qgis_server.models import QGISServerLayer
from geonode.qgis_server.tasks.update import create_qgis_server_thumbnail
from geonode.utils import check_ogc_backend

logger = logging.getLogger("geonode.qgis_server.signals")
QGIS_layer_directory = settings.QGIS_SERVER_CONFIG['layer_directory']

if check_ogc_backend(qgis_server.BACKEND_PACKAGE):
QGIS_layer_directory = settings.QGIS_SERVER_CONFIG['layer_directory']

qgis_map_with_layers = Signal(providing_args=[])

Expand Down Expand Up @@ -307,28 +312,29 @@ def qgis_server_post_save_map(instance, sender, **kwargs):
instance, overwrite=True)


logger.debug('Register signals QGIS Server')
signals.pre_save.connect(
qgis_server_pre_save,
dispatch_uid='Layer-qgis_server_pre_save',
sender=Layer)
signals.pre_delete.connect(
qgis_server_pre_delete,
dispatch_uid='Layer-qgis_server_pre_delete',
sender=Layer)
signals.post_save.connect(
qgis_server_post_save,
dispatch_uid='Layer-qgis_server_post_save',
sender=Layer)
signals.pre_save.connect(
qgis_server_pre_save_maplayer,
dispatch_uid='MapLayer-qgis_server_pre_save_maplayer',
sender=MapLayer)
signals.post_save.connect(
qgis_server_post_save_map,
dispatch_uid='Map-qgis_server_post_save_map',
sender=Map)
signals.pre_delete.connect(
qgis_server_layer_pre_delete,
dispatch_uid='QGISServerLayer-qgis_server_layer_pre_delete',
sender=QGISServerLayer)
if check_ogc_backend(qgis_server.BACKEND_PACKAGE):
logger.debug('Register signals QGIS Server')
signals.pre_save.connect(
qgis_server_pre_save,
dispatch_uid='Layer-qgis_server_pre_save',
sender=Layer)
signals.pre_delete.connect(
qgis_server_pre_delete,
dispatch_uid='Layer-qgis_server_pre_delete',
sender=Layer)
signals.post_save.connect(
qgis_server_post_save,
dispatch_uid='Layer-qgis_server_post_save',
sender=Layer)
signals.pre_save.connect(
qgis_server_pre_save_maplayer,
dispatch_uid='MapLayer-qgis_server_pre_save_maplayer',
sender=MapLayer)
signals.post_save.connect(
qgis_server_post_save_map,
dispatch_uid='Map-qgis_server_post_save_map',
sender=Map)
signals.pre_delete.connect(
qgis_server_layer_pre_delete,
dispatch_uid='QGISServerLayer-qgis_server_layer_pre_delete',
sender=QGISServerLayer)
13 changes: 3 additions & 10 deletions geonode/tests/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import os
import json
import datetime
import unittest
import urllib2
# import base64
import time
Expand Down Expand Up @@ -431,10 +430,7 @@ def test_repeated_upload(self):

# geonode.maps.views

@unittest.skipIf(
hasattr(settings, 'SKIP_GEOSERVER_TEST') and
settings.SKIP_GEOSERVER_TEST,
'Temporarily skip this test until fixed')
@on_ogc_backend(geoserver.BACKEND_PACKAGE)
def test_layer_delete_from_geoserver(self):
"""Verify that layer is correctly deleted from GeoServer
"""
Expand Down Expand Up @@ -471,10 +467,7 @@ def test_layer_delete_from_geoserver(self):
shp_layer.name,
store=tif_store))

@unittest.skipIf(
hasattr(settings, 'SKIP_GEOSERVER_TEST') and
settings.SKIP_GEOSERVER_TEST,
'Temporarily skip this test until fixed')
@on_ogc_backend(geoserver.BACKEND_PACKAGE)
def test_delete_layer(self):
"""Verify that the 'delete_layer' pre_delete hook is functioning
"""
Expand Down Expand Up @@ -507,7 +500,7 @@ def test_delete_layer(self):
self.assertRaises(ObjectDoesNotExist,
lambda: Layer.objects.get(pk=shp_layer_id))

# geonode.geoserver.helpers
# geonode.geoserver.helpers
# If catalogue is installed, then check that it is deleted from there
# too.
if 'geonode.catalogue' in settings.INSTALLED_APPS:
Expand Down

0 comments on commit e5ae9e2

Please sign in to comment.