geonode.security.tests

Attributes

logger

Classes

StreamToLogger

Fake file-like stream object that redirects writes to a logger instance.

SecurityTests

Tests for the Geonode security app.

SecurityRulesTests

Test resources synchronization with Guardian and dirty states cleaning

TestGetUserGeolimits

SetPermissionsTestCase

TestPermissionChanges

TestUserHasPerms

Ensure that the Permission classes behaves as expected

Functions

_log(msg, *args)

Module Contents

geonode.security.tests.logger[source]
geonode.security.tests._log(msg, *args)[source]
class geonode.security.tests.StreamToLogger(logger, log_level=logging.INFO)[source]

Fake file-like stream object that redirects writes to a logger instance.

logger[source]
log_level[source]
linebuf = ''[source]
write(buf)[source]
class geonode.security.tests.SecurityTests[source]

Bases: tastypie.test.ResourceTestCaseMixin, geonode.tests.base.GeoNodeBaseTestSupport

Tests for the Geonode security app.

classmethod setUpClass()[source]
classmethod tearDownClass()[source]
setUp()[source]
test_login_middleware()[source]

Tests the Geonode login required authentication middleware.

test_login_middleware_with_basic_auth()[source]

Tests the Geonode login required authentication middleware with Basic authenticated queries

test_login_middleware_with_custom_login_url()[source]

Tests the Geonode login required authentication middleware with Basic authenticated queries

test_session_ctrl_middleware()[source]

Tests the Geonode session control authentication middleware.

test_attributes_sats_refresh()[source]
test_invalidate_tileddataset_cache()[source]
test_set_bulk_permissions()[source]

Test that after restrict view permissions on two layers bobby is unable to see them

test_bobby_cannot_set_all()[source]

Test that Bobby can set the permissions only on the ones for which he has the right

test_user_can()[source]
test_perm_specs_synchronization()[source]

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

test_dataset_permissions()[source]
test_maplayers_default_permissions()[source]

Verify that Dataset.set_default_permissions is behaving as expected

test_set_dataset_permissions()[source]

Verify that the set_dataset_permissions view is behaving as expected

test_ajax_dataset_permissions()[source]

Verify that the ajax_dataset_permissions view is behaving as expected

test_perms_info()[source]

Verify that the perms_info view is behaving as expected

test_not_superuser_permissions()[source]
test_anonymus_permissions()[source]
test_get_visible_resources_should_return_resource_with_metadata_only_false()[source]
test_get_visible_resources_should_return_updated_resource_with_metadata_only_false()[source]
test_get_visible_resources_should_return_resource_with_metadata_only_true()[source]

If metadata only is provided, it should return only the metadata resources

test_get_visible_resources_should_return_resource_with_metadata_only_none()[source]

If metadata only is provided, it should return only the metadata resources

test_get_visible_resources_advanced_workflow()[source]
test_get_visible_resources()[source]
test_perm_spec_conversion()[source]

Perm Spec from extended to cmpact and viceversa

test_admin_whitelisted_access_backend()[source]
test_admin_whitelisted_access_middleware()[source]
class geonode.security.tests.SecurityRulesTests[source]

Bases: django.test.testcases.TestCase

Test resources synchronization with Guardian and dirty states cleaning

setUp()[source]
test_sync_resources_with_guardian_delay_false()[source]
test_sync_resources_with_guardian_delay_true()[source]
class geonode.security.tests.TestGetUserGeolimits[source]

Bases: django.test.testcases.TestCase

setUp()[source]
test_should_not_disable_cache_for_user_without_geolimits()[source]
test_should_disable_cache_for_user_with_geolimits()[source]
test_should_not_disable_cache_for_anonymous_without_geolimits()[source]
test_should_disable_cache_for_anonymous_with_geolimits()[source]
class geonode.security.tests.SetPermissionsTestCase[source]

Bases: geonode.tests.base.GeoNodeBaseTestSupport

setUp()[source]
test_set_compact_permissions()[source]
AUTO PUBLISHING - test_set_compact_permissions
  • RESOURCE_PUBLISHING = False

  • ADMIN_MODERATE_UPLOADS = False

test_permissions_are_set_as_expected_resource_publishing_True()[source]
SIMPLE PUBLISHING - test_permissions_are_set_as_expected_resource_publishing_True
  • RESOURCE_PUBLISHING = True (Autopublishing is disabled)

  • ADMIN_MODERATE_UPLOADS = False

test_permissions_are_set_as_expected_admin_upload_resource_publishing_True()[source]
ADVANCED WORKFLOW - test_permissions_are_set_as_expected_admin_upload_resource_publishing_True
  • RESOURCE_PUBLISHING = True

  • ADMIN_MODERATE_UPLOADS = True

test_permissions_are_set_as_expected_admin_upload_resource_publishing_False()[source]
AUTO PUBLISHING - test_permissions_are_set_as_expected_admin_upload_resource_publishing_False
  • RESOURCE_PUBLISHING = False

  • ADMIN_MODERATE_UPLOADS = False

test_permissions_on_user_role_promotion_to_manager()[source]
ADVANCED WORKFLOW - test_permissions_on_user_role_promotion_to_manager
  • RESOURCE_PUBLISHING = True

  • ADMIN_MODERATE_UPLOADS = True

test_permissions_on_user_role_demote_to_member()[source]
ADVANCED WORKFLOW - test_permissions_on_user_role_demote_to_member
  • RESOURCE_PUBLISHING = True

  • ADMIN_MODERATE_UPLOADS = True

test_permissions_on_user_role_demote_to_member_only_RESOURCE_PUBLISHING_active()[source]
SIMPLE PUBLISHING - test_permissions_on_user_role_demote_to_member_only_RESOURCE_PUBLISHING_active
  • RESOURCE_PUBLISHING = True (Autopublishing is disabled)

  • ADMIN_MODERATE_UPLOADS = False

test_permissions_on_user_role_promote_to_manager_only_RESOURCE_PUBLISHING_active()[source]
SIMPLE PUBLISHING - test_permissions_on_user_role_promote_to_manager_only_RESOURCE_PUBLISHING_active
  • RESOURCE_PUBLISHING = True (Autopublishing is disabled)

  • ADMIN_MODERATE_UPLOADS = False

class geonode.security.tests.TestPermissionChanges[source]

Bases: geonode.tests.base.GeoNodeBaseTestSupport

setUp()[source]
test_permissions_on_approve_and_publish_changes()[source]
test_owner_is_group_manager()[source]
assertions_for_approved_or_published_is_true()[source]
assertions_for_approved_and_published_is_false()[source]
admin_approve_and_publish_resource()[source]
admin_unapprove_and_unpublish_resource()[source]
class geonode.security.tests.TestUserHasPerms[source]

Bases: geonode.tests.base.GeoNodeBaseTestSupport

Ensure that the Permission classes behaves as expected

classmethod setUpClass() None[source]
classmethod tearDownClass() None[source]
setUp()[source]
test_user_with_view_perms()[source]
test_user_with_view_listing()[source]
test_anonymous_user_is_stripped_off()[source]