geonode.thumbs.tests

Submodules

Attributes

resource_manager

FIXTURES_DIR

http_client

logger

LOCAL_TIMEOUT

EXPECTED_RESULTS_DIR

logger

WMTS_TILEMATRIX_LEVELS

THUMBNAIL_BACKGROUND

EXPECTED_RESULTS_DIR

base_request_url

mocked_requests

Classes

Document

A document is any kind of information that can be attached to a map such as pdf, images, videos, xls...

GeoApp

A GeoApp it is a generic container for every client applications the user might want to create or define.

Dataset

Dataset (inherits ResourceBase fields)

DisableDjangoSignals

Python3 class temporarily disabling django signals on model creation.

Map

A Map aggregates several layers together and annotates them with a viewport

MapLayer

The MapLayer model represents a layer included in a map. This doesn't just

GeoNodeBaseTestSupport

GeoNodeBaseSimpleTestSupport

ThumbnailsUtilsUnitTest

ThumbnailsUnitTest

Map

A Map aggregates several layers together and annotates them with a viewport

MapLayer

The MapLayer model represents a layer included in a map. This doesn't just

ResourceManager

DisableDjangoSignals

Python3 class temporarily disabling django signals on model creation.

GeoNodeBaseTestSupport

Dataset

Dataset (inherits ResourceBase fields)

OSMTileBackground

Helper class that provides a standard way to create an ABC using

WikiMediaTileBackground

Helper class that provides a standard way to create an ABC using

GenericXYZBackground

Helper class that provides a standard way to create an ABC using

GenericWMSBackground

Helper class that provides a standard way to create an ABC using

GeoNodeThumbnailTileBackground

GeoNodeThumbnailsIntegration

GeoNodeBaseTestSupport

GenericWMTSBackground

Helper class that provides a standard way to create an ABC using

Response

GeoNodeThumbnailWMTSBackground

Functions

check_ogc_backend(backend_package)

Check that geonode use a particular OGC Backend integration

on_ogc_backend(backend_package)

Decorator for function specific to a certain ogc backend.

create_gs_thumbnail_geonode(instance[, overwrite, ...])

Create a thumbnail with a GeoServer request.

create_thumbnail(, bbox, Tuple]] = None, forced_crs, ...)

Function generating and saving a thumbnail of the given instance (Dataset or Map), which is composed of

all_public()

Ensure all layers, maps and documents are publicly available

create_models([type, integration])

remove_models(obj_ids[, type, integration])

create_single_dataset(name[, keywords, owner, group])

get_mock(*args)

Package Contents

class geonode.thumbs.tests.Document[source]

Bases: geonode.base.models.ResourceBase

A document is any kind of information that can be attached to a map such as pdf, images, videos, xls…

extension
doc_url
__str__()[source]
get_absolute_url()[source]
allowed_permissions()[source]
compact_permission_labels()[source]
property name
property name_long
property href
property is_local
property download_is_ajax_safe
property is_file
property mime_type
property is_audio
property is_image
property is_video
property class_name
property embed_url
property download_url
class Meta

Bases: geonode.base.models.ResourceBase.Meta

class geonode.thumbs.tests.GeoApp(*args, **kwargs)[source]

Bases: geonode.base.models.ResourceBase

A GeoApp it is a generic container for every client applications the user might want to create or define.

PERMISSIONS
name
last_modified
__str__()[source]
property class_name
property sender
property center
.

A handy shortcut for the center_x and center_y properties as a tuple (read only)

property type
property is_public
.

Returns True if anonymous (public) user can view geoapp.

property keywords_list
get_absolute_url()[source]
property embed_url
geonode.thumbs.tests.resource_manager[source]
class geonode.thumbs.tests.Dataset(*args, **kwargs)[source]

Bases: geonode.base.models.ResourceBase

Dataset (inherits ResourceBase fields)

PERMISSIONS
objects
workspace
store
name
typename
ows_url
is_mosaic
has_time
has_elevation
time_regex
elevation_regex
ptype
default_style
styles
remote_service
charset
use_featureinfo_custom_template
featureinfo_custom_template
is_vector()[source]
property is_raster
property display_type
property data_model
property data_objects
property attributes
property service_typename
property gtype
get_base_file()[source]

Get the shp or geotiff file for this layer.

get_absolute_url()[source]
property capabilities_url
property dataset_ows_url
property embed_url
attribute_config()[source]
__str__()[source]
class Meta

Bases: geonode.base.models.ResourceBase.Meta

permissions = (('change_dataset_data', 'Can edit layer data'), ('change_dataset_style', 'Can change layer style'))
unique_together = ('store', 'workspace', 'name')
LEVEL_READ = 'dataset_readonly'
LEVEL_WRITE = 'dataset_readwrite'
LEVEL_ADMIN = 'dataset_admin'
property maps
get_linked_resources(as_target: bool = False)[source]

Get all the linked resources to this ResourceBase instance. This is implemented as a method so that derived classes can override it (for instance, Maps may add related datasets)

property download_url
property maplayers
allowed_permissions()[source]
property class_name
view_count_up(user, do_local=False)[source]

increase view counter, if user is not owner and not super

@param user which views layer @type User model

@param do_local - do local counter update even if pubsub is enabled @type bool

class geonode.thumbs.tests.DisableDjangoSignals(disabled_signals=None, skip=False)[source]

Python3 class temporarily disabling django signals on model creation.

usage: with DisableDjangoSignals():

skip
stashed_signals
disabled_signals
__enter__()[source]
__exit__(exc_type, exc_val, exc_tb)[source]
disconnect(signal)[source]
reconnect(signal)[source]
class geonode.thumbs.tests.Map(*args, **kwargs)[source]

Bases: geonode.base.models.ResourceBase

A Map aggregates several layers together and annotates them with a viewport configuration.

last_modified
urlsuffix
featuredurl
__str__()[source]
property datasets
get_linked_resources(as_target: bool = False)[source]

Get all the linked resources to this ResourceBase instance. This is implemented as a method so that derived classes can override it (for instance, Maps may add related datasets)

json(dataset_filter)[source]

Get a JSON representation of this map suitable for sending to geoserver for creating a download of all layers

keyword_list()[source]
get_absolute_url()[source]
property embed_url
get_bbox_from_datasets(layers)[source]

Calculate the bbox from a given list of Dataset objects

bbox format: [xmin, xmax, ymin, ymax]

property sender
property class_name
property is_public
Returns True if anonymous (public) user can view map.
property dataset_group
Returns layer group name from local OWS for this map instance.
publish_dataset_group()[source]

Publishes local map layers as WMS layer group on local OWS.

class Meta

Bases: geonode.base.models.ResourceBase.Meta

class geonode.thumbs.tests.MapLayer[source]

Bases: django.db.models.Model

The MapLayer model represents a layer included in a map. This doesn’t just identify the dataset, but also extra options such as which style to load and the file format to use for image tiles.

map
dataset
extra_params
name
store
current_style
ows_url
local
order
visibility
opacity
property dataset_title
Used by geonode/maps/templates/maps/map_download.html
Used by geonode/maps/templates/maps/map_download.html
property get_legend
class Meta
ordering = ['-pk']
__str__()[source]
class geonode.thumbs.tests.GeoNodeBaseTestSupport[source]

Bases: django.test.testcases.TestCase

type = None
obj_ids = []
integration = False
fixtures = ['initial_data.json', 'group_test_data.json', 'default_oauth_apps.json']
get_obj_ids()[source]
get_integration()[source]
get_type()[source]
setUp()[source]
class geonode.thumbs.tests.GeoNodeBaseSimpleTestSupport[source]

Bases: django.test.testcases.SimpleTestCase

geonode.thumbs.tests.FIXTURES_DIR = 'geonode/thumbs/tests/fixtures/'[source]
class geonode.thumbs.tests.ThumbnailsUtilsUnitTest[source]

Bases: geonode.tests.base.GeoNodeBaseSimpleTestSupport

test_create_getmap_request()[source]
test_make_bbox_to_pixels_transf_same()[source]
test_make_bbox_to_pixels_transf_diff()[source]
test_expand_bbox_to_ratio()[source]
class geonode.thumbs.tests.ThumbnailsUnitTest[source]

Bases: geonode.tests.base.GeoNodeBaseTestSupport

fixtures
re_uuid = '[0-F]{8}-([0-F]{4}-){3}[0-F]{12}'
classmethod setUpClass()[source]
test_generate_thumbnail_name_dataset()[source]
test_get_unique_upload_path()[source]
test_generate_thumbnail_name_map_empty(layers_mock)[source]
test_generate_thumbnail_name_map(uuid_mock, layers_mock)[source]
test_generate_thumbnail_name_document()[source]
test_generate_thumbnail_name_geoapp()[source]
test_datasets_locations_dataset()[source]
test_datasets_locations_dataset_default_bbox()[source]
test_datasets_locations_dataset_bbox()[source]
test_datasets_locations_simple_map()[source]
test_datasets_locations_simple_map_default_bbox()[source]
test_datasets_locations_composition_map_default_bbox()[source]
test_create_map_thumbnail_using_ll_bbox_polygon()[source]
class geonode.thumbs.tests.Map(*args, **kwargs)[source]

Bases: geonode.base.models.ResourceBase

A Map aggregates several layers together and annotates them with a viewport configuration.

last_modified
urlsuffix
featuredurl
__str__()[source]
property datasets
get_linked_resources(as_target: bool = False)[source]

Get all the linked resources to this ResourceBase instance. This is implemented as a method so that derived classes can override it (for instance, Maps may add related datasets)

json(dataset_filter)[source]

Get a JSON representation of this map suitable for sending to geoserver for creating a download of all layers

keyword_list()[source]
get_absolute_url()[source]
property embed_url
get_bbox_from_datasets(layers)[source]

Calculate the bbox from a given list of Dataset objects

bbox format: [xmin, xmax, ymin, ymax]

property sender
property class_name
property is_public
Returns True if anonymous (public) user can view map.
property dataset_group
Returns layer group name from local OWS for this map instance.
publish_dataset_group()[source]

Publishes local map layers as WMS layer group on local OWS.

class Meta

Bases: geonode.base.models.ResourceBase.Meta

class geonode.thumbs.tests.MapLayer[source]

Bases: django.db.models.Model

The MapLayer model represents a layer included in a map. This doesn’t just identify the dataset, but also extra options such as which style to load and the file format to use for image tiles.

map
dataset
extra_params
name
store
current_style
ows_url
local
order
visibility
opacity
property dataset_title
Used by geonode/maps/templates/maps/map_download.html
property local_link
Used by geonode/maps/templates/maps/map_download.html
property get_legend
class Meta
ordering = ['-pk']
__str__()[source]
geonode.thumbs.tests.check_ogc_backend(backend_package)[source]

Check that geonode use a particular OGC Backend integration

Parameters:

backend_package (str) – django app of backend to use

Returns:

bool

Return type:

bool

geonode.thumbs.tests.on_ogc_backend(backend_package)[source]

Decorator for function specific to a certain ogc backend.

This decorator will wrap function so it only gets executed if the specified ogc backend is currently used. If not, the function will just be skipped.

Useful to decorate features/tests that only available for specific backend.

class geonode.thumbs.tests.ResourceManager(concrete_manager=None)[source]

Bases: ResourceManagerInterface

_concrete_resource_manager
_get_concrete_manager()[source]
classmethod _get_instance(uuid: str) geonode.base.models.ResourceBase[source]
search(filter: dict, /, resource_type: object | None) django.db.models.query.QuerySet[source]

Returns a QuerySet of the filtered resources into the DB.

  • The ‘filter’ parameter should be an dictionary with the filtering criteria; - ‘filter’ = None won’t return any result - ‘filter’ = {} will return the whole set

  • The ‘resource_type’ parameter allows to specify the concrete resource model (e.g. Dataset, Document, Map, …) - ‘resource_type’ must be a class - ‘resource_type’ = Dataset will return a set of the only available Layers

exists(uuid: str, /, instance: geonode.base.models.ResourceBase = None) bool[source]

Returns ‘True’ or ‘False’ if the resource exists or not.

  • If ‘instance’ is provided, it will take precedence on ‘uuid’

  • The existance criteria might be subject to the ‘concrete resource manager’ one, dependent on the resource type e.g.: a local Dataset existance check will be constrained by the existance of the layer on the GIS backend

delete(uuid: str, /, instance: geonode.base.models.ResourceBase = None) int[source]

Deletes a resource from the DB.

  • If ‘instance’ is provided, it will take precedence on ‘uuid’

  • It will also fallback to the ‘concrete resource manager’ delete model.

  • This will eventually delete the related resources on the GIS backend too.

create(uuid: str, /, resource_type: object | None = None, defaults: dict = {}) geonode.base.models.ResourceBase[source]

The method will just create a new ‘resource_type’ on the DB model and invoke the ‘post save’ triggers.

  • It assumes any GIS backend resource (e.g. layers on GeoServer) already exist.

  • It is possible to pass initial default values, like the ‘files’ from the ‘storage_manager’ trhgouh the ‘defaults’ dictionary

update(uuid: str, /, instance: geonode.base.models.ResourceBase = None, xml_file: str = None, metadata_uploaded: bool = False, vals: dict = {}, regions: list = [], keywords: list = [], custom: dict = {}, notify: bool = True, extra_metadata: list = [], *args, **kwargs) geonode.base.models.ResourceBase[source]

The method will update an existing ‘resource_type’ on the DB model and invoke the ‘post save’ triggers.

  • It assumes any GIS backend resource (e.g. layers on GeoServer) already exist.

  • It is possible to pass initial default values, like the ‘files’ from the ‘storage_manager’ trhgouh the ‘vals’ dictionary

  • The ‘xml_file’ parameter allows to fetch metadata values from a file

  • The ‘notify’ parameter allows to notify the members that the resource has been updated

ingest(files: List[str], /, uuid: str = None, resource_type: object | None = None, defaults: dict = {}, **kwargs) geonode.base.models.ResourceBase[source]

The method allows to create a resource by providing the list of files.

e.g.:

In [1]: from geonode.resource.manager import resource_manager

In [2]: from geonode.layers.models import Dataset

In [3]: from django.contrib.auth import get_user_model

In [4]: admin = get_user_model().objects.get(username=’admin’)

In [5]: files = [“/…/san_andres_y_providencia_administrative.dbf”, “/…/san_andres_y_providencia_administrative.prj”, …: “/…/san_andres_y_providencia_administrative.shx”, “/…/san_andres_y_providencia_administrative.sld”, “/…/san_andres_y_providencia_administrative.shp”]

In [6]: resource_manager.ingest(files, resource_type=Dataset, defaults={‘owner’: admin})

copy(instance: geonode.base.models.ResourceBase, /, uuid: str = None, owner: django.conf.settings.AUTH_USER_MODEL = None, defaults: dict = {}) geonode.base.models.ResourceBase[source]

The method makes a copy of the existing resource.

  • It makes a copy of the files

  • It creates a new layer on the GIS backend in the case the ResourceType is a Dataset

append(instance: geonode.base.models.ResourceBase, vals: dict = {}, *args, **kwargs)[source]

The method appends data to an existing resource.

  • It assumes any GIS backend resource (e.g. layers on GeoServer) already exist.

replace(instance: geonode.base.models.ResourceBase, vals: dict = {}, *args, **kwargs)[source]

The method replaces data of an existing resource.

  • It assumes any GIS backend resource (e.g. layers on GeoServer) already exist.

_validate_resource(instance: geonode.base.models.ResourceBase, action_type: str) bool[source]
exec(method: str, uuid: str, /, instance: geonode.base.models.ResourceBase = None, **kwargs) geonode.base.models.ResourceBase[source]

A generic ‘exec’ method allowing to invoke specific methods of the concrete resource manager not exposed by the interface.

  • The parameter ‘method’ represents the actual name of the concrete method to invoke.

remove_permissions(uuid: str, /, instance: geonode.base.models.ResourceBase = None) bool[source]

Remove object permissions on given resource. If is a layer removes the layer specific permissions then the resourcebase permissions.

set_permissions(uuid: str, /, instance: geonode.base.models.ResourceBase = None, owner: django.conf.settings.AUTH_USER_MODEL = None, permissions: dict = {}, created: bool = False, approval_status_changed: bool = False, group_status_changed: bool = False) bool[source]

Sets the permissions of a resource.

  • It optionally gets a JSON ‘perm_spec’ through the ‘permissions’ parameter

  • If no ‘perm_spec’ is provided, it will set the default permissions (owner only)

set_thumbnail(uuid: str, /, instance: geonode.base.models.ResourceBase = None, overwrite: bool = True, check_bbox: bool = True, thumbnail=None) bool[source]

Allows to generate or re-generate the Thumbnail of a Resource.

geonode.thumbs.tests.http_client[source]
class geonode.thumbs.tests.DisableDjangoSignals(disabled_signals=None, skip=False)[source]

Python3 class temporarily disabling django signals on model creation.

usage: with DisableDjangoSignals():

skip
stashed_signals
disabled_signals
__enter__()[source]
__exit__(exc_type, exc_val, exc_tb)[source]
disconnect(signal)[source]
reconnect(signal)[source]
class geonode.thumbs.tests.GeoNodeBaseTestSupport[source]

Bases: django.test.testcases.TestCase

type = None
obj_ids = []
integration = False
fixtures = ['initial_data.json', 'group_test_data.json', 'default_oauth_apps.json']
get_obj_ids()[source]
get_integration()[source]
get_type()[source]
setUp()[source]
geonode.thumbs.tests.create_gs_thumbnail_geonode(instance, overwrite=False, check_bbox=False)[source]

Create a thumbnail with a GeoServer request.

geonode.thumbs.tests.create_thumbnail(instance: geonode.layers.models.Dataset | geonode.maps.models.Map, wms_version: str = settings.OGC_SERVER['default'].get('WMS_VERSION', '1.3.0'), bbox: List | Tuple | None = None, forced_crs: str | None = None, styles: List | None = None, overwrite: bool = False, background_zoom: int | None = None) None[source]

Function generating and saving a thumbnail of the given instance (Dataset or Map), which is composed of outcomes of WMS GetMap queries to the instance’s datasets providers, and an outcome of querying background provider for thumbnail’s background (by default Slippy Map provider).

Parameters:
  • instance – instance of Dataset or Map models

  • wms_version – WMS version of the query

  • bbox – bounding box of the thumbnail in format: (west, east, south, north, CRS), where CRS is in format “EPSG:XXXX”

  • forced_crs – CRS which should be used to fetch data from WMS services in format “EPSG:XXXX”. By default all data is translated and retrieved in EPSG:3857, since this enables background fetching from Slippy Maps providers. Forcing another CRS can cause skipping background generation in the thumbnail

  • styles – styles, which OGC server should use for rendering an image

  • overwrite – overwrite existing thumbnail

  • background_zoom – zoom of the XYZ Slippy Map used to retrieve background image, if Slippy Map is used as background

class geonode.thumbs.tests.Dataset(*args, **kwargs)[source]

Bases: geonode.base.models.ResourceBase

Dataset (inherits ResourceBase fields)

PERMISSIONS
objects
workspace
store
name
typename
ows_url
is_mosaic
has_time
has_elevation
time_regex
elevation_regex
ptype
default_style
styles
remote_service
charset
use_featureinfo_custom_template
featureinfo_custom_template
is_vector()[source]
property is_raster
property display_type
property data_model
property data_objects
property attributes
property service_typename
property gtype
get_base_file()[source]

Get the shp or geotiff file for this layer.

get_absolute_url()[source]
property capabilities_url
property dataset_ows_url
property embed_url
attribute_config()[source]
__str__()[source]
class Meta

Bases: geonode.base.models.ResourceBase.Meta

permissions = (('change_dataset_data', 'Can edit layer data'), ('change_dataset_style', 'Can change layer style'))
unique_together = ('store', 'workspace', 'name')
LEVEL_READ = 'dataset_readonly'
LEVEL_WRITE = 'dataset_readwrite'
LEVEL_ADMIN = 'dataset_admin'
property maps
get_linked_resources(as_target: bool = False)[source]

Get all the linked resources to this ResourceBase instance. This is implemented as a method so that derived classes can override it (for instance, Maps may add related datasets)

property download_url
property maplayers
allowed_permissions()[source]
property class_name
view_count_up(user, do_local=False)[source]

increase view counter, if user is not owner and not super

@param user which views layer @type User model

@param do_local - do local counter update even if pubsub is enabled @type bool

class geonode.thumbs.tests.OSMTileBackground(thumbnail_width: int, thumbnail_height: int, max_retries: int = 3, retry_delay: int = 1)[source]

Bases: GenericXYZBackground

Helper class that provides a standard way to create an ABC using inheritance.

url = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png'
tile_size = 256
class geonode.thumbs.tests.WikiMediaTileBackground(thumbnail_width: int, thumbnail_height: int, max_retries: int = 3, retry_delay: int = 1)[source]

Bases: GenericXYZBackground

Helper class that provides a standard way to create an ABC using inheritance.

url = 'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png'
tile_size = 256
class geonode.thumbs.tests.GenericXYZBackground(thumbnail_width: int, thumbnail_height: int, max_retries: int = 3, retry_delay: int = 1)[source]

Bases: BaseThumbBackground

Helper class that provides a standard way to create an ABC using inheritance.

options
url
tile_size
tms = False
crs = 'EPSG:3857'
_epsg3857_max_x = 20026376.39
_epsg3857_max_y = 20048966.1
_mercantile_bbox = None
point3857to4326(x, y)[source]
point4326to3857(x, y)[source]
bbox3857to4326(x_min, x_max, y_min, y_max)[source]

Function converting BBOX from EPSG:3857 to EPSG:4326, keeping the order of the coordinates. To ensure no additional change is performed, conversion is based on top-left and bottom-right points conversion.

bbox4326to3857(x_min, x_max, y_min, y_max)[source]

Function converting BBOX from EPSG:4326 to EPSG:3857, keeping the order of the coordinates. To ensure no additional change is performed, conversion is based on top-left and bottom-right points conversion.

fetch(bbox: List, zoom: int = None, *args, **kwargs)[source]

The function fetching tiles from a Slippy Map provider, composing them into a single image, and cropping it to match the given BBOX. Retrieval of each tile is repeated self.max_retries times, waiting self.retry_delay seconds between consecutive requests.

Parameters:
  • bbox – bounding box of the background image, dataset compliant format: [west, east, south, north, CRS]

  • zoom – zoom with which to retrieve Slippy Map’s tiles (by default, it’s calculated based on width, height)

Returns:

None if the CRS is different from self.tiles_crs, or background Image

calculate_zoom()[source]
class geonode.thumbs.tests.GenericWMSBackground(thumbnail_width: int, thumbnail_height: int, max_retries: int = 3, retry_delay: int = 1)[source]

Bases: BaseThumbBackground

Helper class that provides a standard way to create an ABC using inheritance.

options
service_url
dataset_name
format
version
styles
srid
bbox_to_projection(bbox: List)[source]

Function converting BBOX to target projection system, keeping the order of the coordinates. To ensure no additional change is performed, conversion is based on top-left and bottom-right points conversion.

Parameters:

bbox – a dataset compliant BBOX: [west, east, south, north, CRS]

fetch(bbox: List, *args, **kwargs)[source]

Function fetching background image, based on the given BBOX. On error should raise an exception or return None.

Parameters:
  • bbox – a dataset compliant BBOX: [west, east, south, north, CRS]

  • args – not used, kept for API compatibility

  • kargs – not used, kept for API compatibility

geonode.thumbs.tests.all_public()[source]

Ensure all layers, maps and documents are publicly available

geonode.thumbs.tests.create_models(type=None, integration=False)[source]
geonode.thumbs.tests.remove_models(obj_ids, type=None, integration=False)[source]
geonode.thumbs.tests.create_single_dataset(name, keywords=None, owner=None, group=None, **kwargs)[source]
geonode.thumbs.tests.logger[source]
geonode.thumbs.tests.LOCAL_TIMEOUT = 300[source]
geonode.thumbs.tests.EXPECTED_RESULTS_DIR = 'geonode/thumbs/tests/expected_results/'[source]
class geonode.thumbs.tests.GeoNodeThumbnailTileBackground[source]

Bases: geonode.tests.base.GeoNodeBaseTestSupport

dataset_coast_line = None
fixtures = ['initial_data.json', 'group_test_data.json', 'default_oauth_apps.json']
classmethod setUpClass()[source]
classmethod tearDownClass()[source]
test_tile_background_retries(request_mock)[source]
test_tile_background_bbox_conversions()[source]
test_tile_background_bbox_zoom_calculation()[source]
_fetch_and_compare_background(generator, bbox_3857, expected_image_path, zoom=None)[source]
test_tile_background_generic_fetch()[source]
test_tile_background_generic_fetch_zoom()[source]
test_tile_background_wikimedia_fetch()[source]
test_tile_background_osm_fetch()[source]
test_tile_background_tms_fetch()[source]
test_wms_background_retries(request_mock)[source]
test_wms_background_fetch_epsg3857()[source]
test_wms_background_fetch_epsg4326()[source]
class geonode.thumbs.tests.GeoNodeThumbnailsIntegration[source]

Bases: geonode.tests.base.GeoNodeBaseTestSupport

dataset_coast_line = None
dataset_highway = None
map_composition = None
classmethod setUpClass()[source]
_fetch_thumb_and_compare(url, expected_image)[source]
test_dataset_default_thumb()[source]
test_dataset_custom_thumbs()[source]
test_map_default_thumb()[source]
test_map_custom_thumbs()[source]
test_UTM_dataset_thumbnail()[source]
class geonode.thumbs.tests.GeoNodeBaseTestSupport[source]

Bases: django.test.testcases.TestCase

type = None
obj_ids = []
integration = False
fixtures = ['initial_data.json', 'group_test_data.json', 'default_oauth_apps.json']
get_obj_ids()[source]
get_integration()[source]
get_type()[source]
setUp()[source]
class geonode.thumbs.tests.GenericWMTSBackground(thumbnail_width: int, thumbnail_height: int, max_retries: int = 3, retry_delay: int = 1)[source]

Bases: BaseThumbBackground

Helper class that provides a standard way to create an ABC using inheritance.

options
levels
thumbnail_width
thumbnail_height
fetch(bbox: List, *args, **kwargs)[source]

Function fetching background image, based on the given BBOX. On error should raise an exception or return None.

Parameters:

bbox – a dataset compliant BBOX: [west, east, south, north, CRS]

build_kvp_request(baseurl, layer, style, xyz)[source]
build_request(xyz)[source]
get_image_bbox_for_level(level, bbox)[source]
get_tiles_coords(level, bbox)[source]
get_level_for_targetpixelspan(target_pixelspan)[source]
get_target_pixelspan(bbox)[source]
get_levels_for_tilematrix()[source]
geonode.thumbs.tests.logger[source]
geonode.thumbs.tests.WMTS_TILEMATRIX_LEVELS[source]
geonode.thumbs.tests.THUMBNAIL_BACKGROUND[source]
geonode.thumbs.tests.EXPECTED_RESULTS_DIR = 'geonode/thumbs/tests/expected_results/'[source]
geonode.thumbs.tests.base_request_url = 'https://myserver.com/WMTS?&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=Hos...[source]
geonode.thumbs.tests.mocked_requests[source]
class geonode.thumbs.tests.Response(status_code=200, content=None)[source]
status_code
content
geonode.thumbs.tests.get_mock(*args)[source]
class geonode.thumbs.tests.GeoNodeThumbnailWMTSBackground[source]

Bases: geonode.tests.base.GeoNodeBaseTestSupport

classmethod setUpClass()[source]
test_get_target_pixelspan(*args)[source]
test_get_level_for_targetpixelspan(*args)[source]
test_get_tiles_coords(*args)[source]
test_build_request(*args)[source]
test_tile_request(*args)[source]