geonode.security.tests ====================== .. py:module:: geonode.security.tests Attributes ---------- .. autoapisummary:: geonode.security.tests.logger Classes ------- .. autoapisummary:: geonode.security.tests.StreamToLogger geonode.security.tests.SecurityTests geonode.security.tests.SecurityRulesTests geonode.security.tests.TestGetUserGeolimits geonode.security.tests.SetPermissionsTestCase geonode.security.tests.TestPermissionChanges geonode.security.tests.TestUserHasPerms Functions --------- .. autoapisummary:: geonode.security.tests._log Module Contents --------------- .. py:data:: logger .. py:function:: _log(msg, *args) .. py:class:: StreamToLogger(logger, log_level=logging.INFO) Fake file-like stream object that redirects writes to a logger instance. .. py:attribute:: logger .. py:attribute:: log_level .. py:attribute:: linebuf :value: '' .. py:method:: write(buf) .. py:class:: SecurityTests Bases: :py:obj:`tastypie.test.ResourceTestCaseMixin`, :py:obj:`geonode.tests.base.GeoNodeBaseTestSupport` Tests for the Geonode security app. .. py:method:: setUpClass() :classmethod: .. py:method:: tearDownClass() :classmethod: .. py:method:: setUp() .. py:method:: test_login_middleware() Tests the Geonode login required authentication middleware. .. py:method:: test_login_middleware_with_basic_auth() Tests the Geonode login required authentication middleware with Basic authenticated queries .. py:method:: test_login_middleware_with_custom_login_url() Tests the Geonode login required authentication middleware with Basic authenticated queries .. py:method:: test_session_ctrl_middleware() Tests the Geonode session control authentication middleware. .. py:method:: test_attributes_sats_refresh() .. py:method:: test_invalidate_tileddataset_cache() .. py:method:: test_set_bulk_permissions() Test that after restrict view permissions on two layers bobby is unable to see them .. py:method:: test_bobby_cannot_set_all() Test that Bobby can set the permissions only on the ones for which he has the right .. py:method:: test_user_can() .. py:method:: test_perm_specs_synchronization() Test that Dataset is correctly synchronized with guardian: 1. Set permissions to all users 2. Set permissions to a single user 3. Set permissions to a group of users 4. Try to sync a layer from GeoServer .. py:method:: test_dataset_permissions() .. py:method:: test_maplayers_default_permissions() Verify that Dataset.set_default_permissions is behaving as expected .. py:method:: test_set_dataset_permissions() Verify that the set_dataset_permissions view is behaving as expected .. py:method:: test_ajax_dataset_permissions() Verify that the ajax_dataset_permissions view is behaving as expected .. py:method:: test_perms_info() Verify that the perms_info view is behaving as expected .. py:method:: test_not_superuser_permissions() .. py:method:: test_anonymus_permissions() .. py:method:: test_get_visible_resources_should_return_resource_with_metadata_only_false() .. py:method:: test_get_visible_resources_should_return_updated_resource_with_metadata_only_false() .. py:method:: test_get_visible_resources_should_return_resource_with_metadata_only_true() If metadata only is provided, it should return only the metadata resources .. py:method:: test_get_visible_resources_should_return_resource_with_metadata_only_none() If metadata only is provided, it should return only the metadata resources .. py:method:: test_get_visible_resources_advanced_workflow() .. py:method:: test_get_visible_resources() .. py:method:: test_perm_spec_conversion() Perm Spec from extended to cmpact and viceversa .. py:method:: test_admin_whitelisted_access_backend() .. py:method:: test_admin_whitelisted_access_middleware() .. py:class:: SecurityRulesTests Bases: :py:obj:`django.test.testcases.TestCase` Test resources synchronization with Guardian and dirty states cleaning .. py:method:: setUp() .. py:method:: test_sync_resources_with_guardian_delay_false() .. py:method:: test_sync_resources_with_guardian_delay_true() .. py:class:: TestGetUserGeolimits Bases: :py:obj:`django.test.testcases.TestCase` .. py:method:: setUp() .. py:method:: test_should_not_disable_cache_for_user_without_geolimits() .. py:method:: test_should_disable_cache_for_user_with_geolimits() .. py:method:: test_should_not_disable_cache_for_anonymous_without_geolimits() .. py:method:: test_should_disable_cache_for_anonymous_with_geolimits() .. py:class:: SetPermissionsTestCase Bases: :py:obj:`geonode.tests.base.GeoNodeBaseTestSupport` .. py:method:: setUp() .. py:method:: test_set_compact_permissions() **AUTO PUBLISHING** - test_set_compact_permissions - `RESOURCE_PUBLISHING = False` - `ADMIN_MODERATE_UPLOADS = False` .. py:method:: test_permissions_are_set_as_expected_resource_publishing_True() **SIMPLE PUBLISHING** - test_permissions_are_set_as_expected_resource_publishing_True - `RESOURCE_PUBLISHING = True` (Autopublishing is disabled) - `ADMIN_MODERATE_UPLOADS = False` .. py:method:: test_permissions_are_set_as_expected_admin_upload_resource_publishing_True() **ADVANCED WORKFLOW** - test_permissions_are_set_as_expected_admin_upload_resource_publishing_True - `RESOURCE_PUBLISHING = True` - `ADMIN_MODERATE_UPLOADS = True` .. py:method:: test_permissions_are_set_as_expected_admin_upload_resource_publishing_False() **AUTO PUBLISHING** - test_permissions_are_set_as_expected_admin_upload_resource_publishing_False - `RESOURCE_PUBLISHING = False` - `ADMIN_MODERATE_UPLOADS = False` .. py:method:: test_permissions_on_user_role_promotion_to_manager() **ADVANCED WORKFLOW** - test_permissions_on_user_role_promotion_to_manager - `RESOURCE_PUBLISHING = True` - `ADMIN_MODERATE_UPLOADS = True` .. py:method:: test_permissions_on_user_role_demote_to_member() **ADVANCED WORKFLOW** - test_permissions_on_user_role_demote_to_member - `RESOURCE_PUBLISHING = True` - `ADMIN_MODERATE_UPLOADS = True` .. py:method:: test_permissions_on_user_role_demote_to_member_only_RESOURCE_PUBLISHING_active() **SIMPLE PUBLISHING** - test_permissions_on_user_role_demote_to_member_only_RESOURCE_PUBLISHING_active - `RESOURCE_PUBLISHING = True` (Autopublishing is disabled) - `ADMIN_MODERATE_UPLOADS = False` .. py:method:: test_permissions_on_user_role_promote_to_manager_only_RESOURCE_PUBLISHING_active() **SIMPLE PUBLISHING** - test_permissions_on_user_role_promote_to_manager_only_RESOURCE_PUBLISHING_active - `RESOURCE_PUBLISHING = True` (Autopublishing is disabled) - `ADMIN_MODERATE_UPLOADS = False` .. py:class:: TestPermissionChanges Bases: :py:obj:`geonode.tests.base.GeoNodeBaseTestSupport` .. py:method:: setUp() .. py:method:: test_permissions_on_approve_and_publish_changes() .. py:method:: test_owner_is_group_manager() .. py:method:: assertions_for_approved_or_published_is_true() .. py:method:: assertions_for_approved_and_published_is_false() .. py:method:: admin_approve_and_publish_resource() .. py:method:: admin_unapprove_and_unpublish_resource() .. py:class:: TestUserHasPerms Bases: :py:obj:`geonode.tests.base.GeoNodeBaseTestSupport` Ensure that the Permission classes behaves as expected .. py:method:: setUpClass() -> None :classmethod: .. py:method:: tearDownClass() -> None :classmethod: .. py:method:: setUp() .. py:method:: test_user_with_view_perms() .. py:method:: test_user_with_view_listing() .. py:method:: test_anonymous_user_is_stripped_off()