geonode.layers.tests ==================== .. py:module:: geonode.layers.tests Attributes ---------- .. autoapisummary:: geonode.layers.tests.logger Classes ------- .. autoapisummary:: geonode.layers.tests.DatasetsTest geonode.layers.tests.TestLayerDetailMapViewRights geonode.layers.tests.LayerNotificationsTestCase geonode.layers.tests.DummyUUIDHandler geonode.layers.tests.TestCustomUUidHandler geonode.layers.tests.TestSetMetadata geonode.layers.tests.TestCustomMetadataParser geonode.layers.tests.TestIsXmlUploadOnly geonode.layers.tests.TestIsSldUploadOnly geonode.layers.tests.TestDatasetForm geonode.layers.tests.SetLayersPermissionsCommand geonode.layers.tests.TestDatasetDownloadHandler geonode.layers.tests.DummyDownloadHandler geonode.layers.tests.TestCustomDownloadHandler Functions --------- .. autoapisummary:: geonode.layers.tests.dummy_metadata_parser Module Contents --------------- .. py:data:: logger .. py:class:: DatasetsTest Bases: :py:obj:`geonode.tests.base.GeoNodeBaseTestSupport` Tests geonode.layers app/module .. py:attribute:: type :value: 'dataset' .. py:attribute:: fixtures :value: ['initial_data.json', 'group_test_data.json', 'default_oauth_apps.json'] .. py:method:: setUpClass() :classmethod: .. py:method:: tearDownClass() :classmethod: .. py:method:: setUp() .. py:method:: test_admin_save_model() .. py:method:: test_default_sourcetype() .. py:method:: test_describe_data_2() /data/geonode:CA/metadata -> Test accessing the description of a layer .. py:method:: test_describe_data_3() /data/geonode:CA/metadata_detail -> Test accessing the description of a layer .. py:method:: test_dataset_name_clash() .. py:method:: test_describe_data() /data/geonode:CA/metadata -> Test accessing the description of a layer .. py:method:: test_dataset_attributes() .. py:method:: test_dataset_bbox() .. py:method:: test_dataset_attributes_feature_catalogue() Test layer feature catalogue functionality .. py:method:: test_dataset_attribute_config() .. py:method:: test_dataset_styles() .. py:method:: test_dataset_links() .. py:method:: test_get_valid_user() .. py:method:: testShapefileValidation() .. py:method:: testGeoTiffValidation() .. py:method:: testASCIIValidation() .. py:method:: testZipValidation() .. py:method:: testWriteFiles() .. py:method:: test_dataset_type() .. py:method:: test_get_files() .. py:method:: test_get_valid_name() .. py:method:: test_get_valid_dataset_name() .. py:method:: testJSONField() .. py:method:: test_rating_dataset_remove() Test layer rating is removed on layer remove .. py:method:: test_sld_upload() Test layer remove functionality .. py:method:: test_category_counts() .. py:method:: test_assign_change_dataset_data_perm() Ensure set_permissions supports the change_dataset_data permission. .. py:method:: test_batch_edit() Test batch editing of metadata fields. .. py:method:: test_surrogate_escape_string() .. py:method:: test_assign_remove_permissions() .. py:method:: test_assign_remove_permissions_for_groups() .. py:method:: test_xml_form_without_files_should_raise_500() .. py:method:: test_xml_should_return_404_if_the_dataset_does_not_exists() .. py:method:: test_xml_should_update_the_dataset_with_the_expected_values() .. py:method:: test_sld_should_raise_500_if_is_invalid() .. py:method:: test_sld_should_update_the_dataset_with_the_expected_values() .. py:method:: test_xml_should_raise_an_error_if_the_uuid_is_changed() If the UUID coming from the XML and the one saved in the DB are different The system should raise an error .. py:method:: test_will_raise_exception_for_replace_vector_dataset_with_raster() .. py:method:: test_will_raise_exception_for_replace_dataset_with_unknown_format() .. py:method:: test_will_raise_exception_for_replace_dataset_with_different_file_name() .. py:method:: test_will_raise_exception_for_not_existing_dataset_in_the_catalog(catalog) .. py:method:: test_will_raise_exception_if_schema_is_not_equal_between_catalog_and_file(catalog) .. py:method:: test_validation_will_pass_for_valid_append(catalog) .. py:method:: test_dataset_download_not_found_for_non_existing_dataset() .. py:method:: test_dataset_download_redirect_to_proxy_url() .. py:method:: test_dataset_download_invalid_wps_format() .. py:method:: test_dataset_download_call_the_catalog_raise_error_for_no_200(mocked_catalog) .. py:method:: test_dataset_download_call_the_catalog_raise_error_for_error_content() .. py:method:: test_dataset_download_call_the_catalog_works() .. py:method:: test_dataset_download_call_the_catalog_not_work_without_download_resurcebase_perm() .. py:method:: test_dataset_download_call_the_catalog_work_anonymous() .. py:method:: test_dataset_download_call_the_catalog_work_for_raster(pathed_template) .. py:method:: test_dataset_download_call_the_catalog_work_for_vector(pathed_template) .. py:class:: TestLayerDetailMapViewRights Bases: :py:obj:`geonode.tests.base.GeoNodeBaseTestSupport` .. py:attribute:: fixtures :value: ['initial_data.json', 'group_test_data.json', 'default_oauth_apps.json'] .. py:method:: setUpClass() :classmethod: .. py:method:: tearDownClass() :classmethod: .. py:method:: setUp() .. py:method:: test_that_keyword_multiselect_is_disabled_for_non_admin_users() Test that keyword multiselect widget is disabled when the user is not an admin .. py:method:: test_that_keyword_multiselect_is_not_disabled_for_admin_users() Test that only admin users can create/edit keywords when FREETEXT_KEYWORDS_READONLY=True .. py:method:: test_that_featured_enabling_and_disabling_for_users() .. py:method:: test_that_non_admin_user_cannot_create_edit_keyword() Test that non admin users cannot edit/create keywords when FREETEXT_KEYWORDS_READONLY=True .. py:method:: test_that_keyword_multiselect_is_enabled_for_non_admin_users_when_freetext_keywords_readonly_istrue() Test that keyword multiselect widget is not disabled when the user is not an admin and FREETEXT_KEYWORDS_READONLY=False .. py:method:: test_that_only_users_with_permissions_can_view_maps_in_dataset_view() Test only users with view permissions to a map can view them in layer detail view .. py:method:: test_update_with_a_comma_in_title_is_replaced_by_undescore() Test that when changing the dataset title, if the entered title has a comma it is replaced by an undescore. .. py:class:: LayerNotificationsTestCase Bases: :py:obj:`geonode.tests.utils.NotificationsTestsHelper` Helper class for notification tests This provides: .. py:attribute:: type :value: 'dataset' .. py:method:: setUpClass() :classmethod: .. py:method:: tearDownClass() :classmethod: .. py:method:: setUp() .. py:method:: testLayerNotifications() .. py:class:: DummyUUIDHandler(instance) .. py:attribute:: instance .. py:method:: create_uuid() .. py:class:: TestCustomUUidHandler Bases: :py:obj:`django.test.TestCase` .. py:method:: setUp() .. py:method:: test_dataset_will_maintain_his_uud_if_no_handler_is_definded() .. py:method:: test_dataset_will_override_the_uuid_if_handler_is_defined() .. py:class:: TestSetMetadata Bases: :py:obj:`django.test.TestCase` .. py:method:: setUp() .. py:method:: test_set_metadata_will_rase_an_exception_if_is_not_valid_xml() .. py:method:: test_set_metadata_return_expected_values_from_xml() .. py:method:: test_convert_keyword_should_empty_list_for_empty_keyword() .. py:method:: test_convert_keyword_should_empty_list_for_non_empty_keyword() .. py:class:: TestCustomMetadataParser Bases: :py:obj:`django.test.TestCase` .. py:method:: setUp() .. py:method:: test_will_use_only_the_default_metadata_parser() .. py:method:: test_will_use_both_parsers_defined() .. py:method:: test_convert_keyword_should_empty_list_for_empty_keyword() .. py:method:: test_convert_keyword_should_non_empty_list_for_empty_keyword() .. py:function:: dummy_metadata_parser(exml, uuid, vals, regions, keywords, custom) .. py:class:: TestIsXmlUploadOnly Bases: :py:obj:`django.test.TestCase` This function will check if the files uploaded is a metadata file .. py:method:: setUp() .. py:method:: test_give_single_file_should_return_True() .. py:method:: test_give_single_file_should_return_False() .. py:class:: TestIsSldUploadOnly Bases: :py:obj:`django.test.TestCase` This function will check if the files uploaded is a metadata file .. py:method:: setUp() .. py:method:: test_give_single_file_should_return_True() .. py:method:: test_give_single_file_should_return_False() .. py:class:: TestDatasetForm Bases: :py:obj:`geonode.tests.base.GeoNodeBaseTestSupport` .. py:method:: setUp() -> None .. py:method:: test_resource_form_is_invalid_extra_metadata_not_json_format() .. py:method:: test_change_owner_in_metadata() .. py:method:: test_resource_form_is_invalid_extra_metadata_not_schema_in_settings() .. py:method:: test_resource_form_is_invalid_extra_metadata_invalids_schema_entry() .. py:method:: test_resource_form_is_valid_extra_metadata() .. py:method:: test_dataset_time_form_should_work() .. py:method:: test_dataset_time_form_should_work_with_date_attribute() .. py:method:: test_timeserie_raise_error_if_not_valid_attribute() .. py:method:: test_dataset_time_form_should_raise_error_if_invalid_payload() .. py:method:: test_resource_form_is_valid_single_user_contact_role() test if passing a single user to a contact role form is working .. py:method:: test_resource_form_is_valid_multiple_user_contact_role_as_queryset() test if passing a multiple user to a contact role form is working .. py:method:: test_resource_form_is_invalid_with_incompleted_timeserie_data() .. py:class:: SetLayersPermissionsCommand Bases: :py:obj:`geonode.tests.base.GeoNodeBaseTestSupport` Unittest to ensure that the management command "set_layers_permissions" behaves as expected .. py:method:: test_user_get_the_download_permissions_for_the_selected_dataset() Given a user, the compact perms and the resource id, it shoul set the permissions for the selected resource .. py:method:: test_user_get_the_view_permissions_for_the_selected_dataset() Given a user, the compact perms and the resource id, it shoul set the permissions for the selected resource .. py:method:: test_user_get_the_edit_permissions_for_the_selected_dataset() Given a user, the compact perms and the resource id, it shoul set the permissions for the selected resource .. py:method:: test_user_get_the_manage_permissions_for_the_selected_dataset() Given a user, the compact perms and the resource id, it shoul set the permissions for the selected resource .. py:method:: test_anonymous_user_cannot_get_edit_permissions() Given the Anonymous user, we should get an error trying to set "edit" permissions. .. py:method:: test_unset_anonymous_view_permissions() Given the Anonymous user, we should be able to unset any paermission. .. py:method:: _create_arguments(perms_type, mode='set') .. py:method:: _assert_perms(expected_perms, dataset, username, assertion=True) .. py:class:: TestDatasetDownloadHandler Bases: :py:obj:`geonode.tests.base.GeoNodeBaseTestSupport` .. py:method:: setUp() .. py:method:: test_download_url_without_original_link() .. py:method:: test_download_url_with_original_link() .. py:method:: test_get_resource_exists() .. py:method:: test_process_dowload() .. py:class:: DummyDownloadHandler(request, resource_name) Bases: :py:obj:`geonode.layers.download_handler.DatasetDownloadHandler` .. py:method:: get_download_response() Basic method. Should return the Response object that allow the resource download .. py:class:: TestCustomDownloadHandler Bases: :py:obj:`geonode.tests.base.GeoNodeBaseTestSupport` .. py:method:: test_download_custom_handler()