'Verify that the \'delete_layer\' pre_delete hook is functioning'

def test_delete_layer(self):

    gs_cat = gs_catalog
    shp_file = os.path.join(gisdata.VECTOR_DATA, 'san_andres_y_providencia_poi.shp')
    shp_layer = file_upload(shp_file)
    shp_layer_id = shp_layer.pk
    ws = gs_cat.get_workspace(shp_layer.workspace)
    shp_store = gs_cat.get_store(shp_layer.store, ws)
    shp_store_name = shp_store.name
    uuid = shp_layer.uuid
    shp_layer.delete()
    self.assertRaises(FailedRequestError, (lambda : gs_cat.get_store(shp_store_name)))
    self.assertRaises(ObjectDoesNotExist, (lambda : Layer.objects.get(pk=shp_layer_id)))
    if ('geonode.catalogue' in settings.INSTALLED_APPS):
        from geonode.catalogue import get_catalogue
        catalogue = get_catalogue()
        shp_layer_gn_info = catalogue.get_record(uuid)
        assert (shp_layer_gn_info is None)
