tests.test_geoserver

These tests require a working Geoserver instance.

They can be run with the Make test-geoserver target. More integration tests should be in Jupyter Notebook format as is the case with Birdhouse-deploy / DACCS platform.

Attributes

CURR_DIR

Classes

TestGeoserver

TestGeoserverRequests

TestGeoserverPermissions

Test cases to validate the synchronization between Magpie permissions and file permissions in a Geoserver workspace.

Functions

get_geoserver_settings()

Setup basic parameters for an unmodified local test run (using the example files) unless environment variables are

prepare_geoserver_test_workspace(→ Tuple[str, str])

Prepares a workspace, its datastore and a test shapefile along with the associated Geoserver resources.

reset_geoserver_test_workspace(test_instance, ...)

Removes a workspace on the file system and the associated resources on Geoserver.

copy_shapefile(→ None)

get_datastore_path(→ str)

Module Contents

tests.test_geoserver.CURR_DIR[source]
tests.test_geoserver.get_geoserver_settings()[source]

Setup basic parameters for an unmodified local test run (using the example files) unless environment variables are set.

tests.test_geoserver.prepare_geoserver_test_workspace(test_instance: TestGeoserver, geoserver_handler: cowbird.handlers.impl.geoserver.Geoserver, workspace_key: str) Tuple[str, str][source]

Prepares a workspace, its datastore and a test shapefile along with the associated Geoserver resources.

tests.test_geoserver.reset_geoserver_test_workspace(test_instance, geoserver_handler)[source]

Removes a workspace on the file system and the associated resources on Geoserver.

tests.test_geoserver.copy_shapefile(basename: str, destination: str) None[source]
tests.test_geoserver.get_datastore_path(workspace_path: str) str[source]
class tests.test_geoserver.TestGeoserver[source]
geoserver_settings[source]
workspaces[source]
workspace_folders[source]
test_shapefile_name = 'Espace_Vert'[source]
teardown_class()[source]
static get_geoserver()[source]
class tests.test_geoserver.TestGeoserverRequests[source]

Bases: TestGeoserver

workspaces[source]
workspace_folders[source]
teardown_class()[source]
geoserver()[source]
test_workspace_creation(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None[source]
test_empty_workspace_removal(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None[source]
test_duplicate_workspace(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None[source]
test_workspace_removal(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None[source]
test_datastore_creation(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None[source]
test_datastore_creation_missing_workspace(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None[source]
test_datastore_configuration(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None[source]
test_duplicate_datastore(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None[source]
test_publish_and_remove_shapefile(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None[source]
class tests.test_geoserver.TestGeoserverPermissions[source]

Bases: TestGeoserver

Test cases to validate the synchronization between Magpie permissions and file permissions in a Geoserver workspace.

See Components - Geoserver for more details on the design/implementation choices.

setup_class()[source]
teardown_class()[source]
setup(tmpdir)[source]
check_magpie_permissions(res_id, expected_perms, expected_access=Access.ALLOW.value, expected_scope=Scope.MATCH.value, effective=True)[source]

Checks if a resource has the expected permissions on Magpie for a specific access and scope value.

test_shapefile_on_created()[source]

Tests if the right Magpie permissions are created upon a shapefile creation in a Geoserver workspace.

test_shapefile_on_modified()[source]

Tests if the right Magpie permissions are updated upon a shapefile permission modification in a Geoserver workspace.

test_shapefile_on_modified_other_ext()[source]

Tests modification events on any other file of the shapefile that does not have the main extension (.shp), which should not trigger any other event or modification.

test_shapefile_on_deleted()[source]

Tests if the right Magpie permissions are deleted upon a shapefile removal in a Geoserver workspace.

test_workspace_on_created()[source]
test_workspace_on_modified()[source]

Tests if Magpie resources associated with the user workspace are updated correctly.

test_workspace_on_deleted(caplog)[source]

Tests if Magpie resources associated with the user workspace are deleted only when a user_deleted event is triggered.

test_magpie_layer_permissions()[source]

Tests modifications on layer permissions on Magpie and the resulting updates of the permissions on the related files.

apply_and_check_recursive_permissions(resource_id, resource_name)[source]

Used in different test cases to check the creation and deletion of a recursive permission on Magpie, validating if the resource’s files and all the children resources’ files are updated.

test_magpie_workspace_permission()[source]

Tests modifications on a workspace’s recursive permissions on Magpie and the updates of the related files.

test_magpie_service_permission()[source]

Tests modifications on a service’s recursive permissions on Magpie and the updates of the related files.

test_group_permission()[source]

Tests modifications on a resource’s group permission, which should not trigger any change to the associated path on the file system, since the Geoserver handler does not support groups.