tests.test_geoserver ==================== .. py:module:: tests.test_geoserver .. autoapi-nested-parse:: 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. Classes ------- .. autoapisummary:: tests.test_geoserver.TestGeoserver tests.test_geoserver.TestGeoserverRequests tests.test_geoserver.TestGeoserverPermissions Functions --------- .. autoapisummary:: tests.test_geoserver.get_geoserver_settings tests.test_geoserver.prepare_geoserver_test_workspace tests.test_geoserver.reset_geoserver_test_workspace tests.test_geoserver.copy_shapefile tests.test_geoserver.get_datastore_path Module Contents --------------- .. py:function:: get_geoserver_settings() Setup basic parameters for an unmodified local test run (using the example files) unless environment variables are set. .. py:function:: prepare_geoserver_test_workspace(test_instance: TestGeoserver, geoserver_handler: cowbird.handlers.impl.geoserver.Geoserver, workspace_key: str) -> Tuple[str, str] Prepares a workspace, its datastore and a test shapefile along with the associated Geoserver resources. .. py:function:: reset_geoserver_test_workspace(test_instance, geoserver_handler) Removes a workspace on the file system and the associated resources on Geoserver. .. py:function:: copy_shapefile(basename: str, destination: str) -> None .. py:function:: get_datastore_path(workspace_path: str) -> str .. py:class:: TestGeoserver Bases: :py:obj:`tests.utils.TestConfig` .. py:attribute:: geoserver_settings .. py:attribute:: workspaces .. py:attribute:: workspace_folders .. py:attribute:: test_shapefile_name :value: 'Espace_Vert' .. py:method:: setup_class() .. py:method:: teardown_class() .. py:method:: get_geoserver() :staticmethod: .. py:class:: TestGeoserverRequests Bases: :py:obj:`TestGeoserver` .. py:attribute:: workspaces .. py:attribute:: workspace_folders .. py:method:: teardown_class() .. py:method:: geoserver() .. py:method:: test_workspace_creation(geoserver: cowbird.handlers.impl.geoserver.Geoserver) -> None .. py:method:: test_empty_workspace_removal(geoserver: cowbird.handlers.impl.geoserver.Geoserver) -> None .. py:method:: test_duplicate_workspace(geoserver: cowbird.handlers.impl.geoserver.Geoserver) -> None .. py:method:: test_workspace_removal(geoserver: cowbird.handlers.impl.geoserver.Geoserver) -> None .. py:method:: test_datastore_creation(geoserver: cowbird.handlers.impl.geoserver.Geoserver) -> None .. py:method:: test_datastore_creation_missing_workspace(geoserver: cowbird.handlers.impl.geoserver.Geoserver) -> None .. py:method:: test_datastore_configuration(geoserver: cowbird.handlers.impl.geoserver.Geoserver) -> None .. py:method:: test_duplicate_datastore(geoserver: cowbird.handlers.impl.geoserver.Geoserver) -> None .. py:method:: test_publish_and_remove_shapefile(geoserver: cowbird.handlers.impl.geoserver.Geoserver) -> None .. py:class:: TestGeoserverPermissions Bases: :py:obj:`TestGeoserver` Test cases to validate the synchronization between Magpie permissions and file permissions in a Geoserver workspace. See :ref:`Components - Geoserver ` for more details on the design/implementation choices. .. py:method:: setup_class() .. py:method:: teardown_class() .. py:method:: setup(tmpdir) .. py:method:: check_magpie_permissions(res_id, expected_perms, expected_access=Access.ALLOW.value, expected_scope=Scope.MATCH.value, effective=True) Checks if a resource has the expected permissions on Magpie for a specific access and scope value. .. py:method:: test_shapefile_on_created() Tests if the right Magpie permissions are created upon a shapefile creation in a Geoserver workspace. .. py:method:: test_shapefile_on_modified() Tests if the right Magpie permissions are updated upon a shapefile permission modification in a Geoserver workspace. .. py:method:: test_shapefile_on_modified_other_ext() 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. .. py:method:: test_shapefile_on_deleted() Tests if the right Magpie permissions are deleted upon a shapefile removal in a Geoserver workspace. .. py:method:: test_workspace_on_created() .. py:method:: test_workspace_on_modified() Tests if Magpie resources associated with the user workspace are updated correctly. .. py:method:: test_workspace_on_deleted(caplog) Tests if Magpie resources associated with the user workspace are deleted only when a `user_deleted` event is triggered. .. py:method:: test_magpie_layer_permissions() Tests modifications on layer permissions on Magpie and the resulting updates of the permissions on the related files. .. py:method:: apply_and_check_recursive_permissions(resource_id, resource_name) 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. .. py:method:: test_magpie_workspace_permission() Tests modifications on a workspace's recursive permissions on Magpie and the updates of the related files. .. py:method:: test_magpie_service_permission() Tests modifications on a service's recursive permissions on Magpie and the updates of the related files. .. py:method:: test_group_permission() 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.