geonode.br.tests ================ .. py:module:: geonode.br.tests Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/geonode/br/tests/factories/index /autoapi/geonode/br/tests/test_backup/index /autoapi/geonode/br/tests/test_restore/index /autoapi/geonode/br/tests/test_restore_helpers/index Classes ------- .. autoapisummary:: geonode.br.tests.GeoNodeBaseTestSupport geonode.br.tests.RestoredBackupFactory geonode.br.tests.Configuration geonode.br.tests.RestoreCommandTests geonode.br.tests.GeoNodeBaseTestSupport geonode.br.tests.RestoredBackupFactory geonode.br.tests.RestoreCommand geonode.br.tests.RestoreCommandHelpersTests geonode.br.tests.GeoNodeBaseTestSupport geonode.br.tests.Configuration geonode.br.tests.BackupCommandTests Functions --------- .. autoapisummary:: geonode.br.tests.md5_file_hash geonode.br.tests.md5_file_hash Package Contents ---------------- .. py:class:: GeoNodeBaseTestSupport Bases: :py:obj:`django.test.testcases.TestCase` .. py:attribute:: type :value: None .. py:attribute:: obj_ids :value: [] .. py:attribute:: integration :value: False .. py:attribute:: fixtures :value: ['initial_data.json', 'group_test_data.json', 'default_oauth_apps.json'] .. py:method:: get_obj_ids() .. py:method:: get_integration() .. py:method:: get_type() .. py:method:: setUp() .. py:class:: RestoredBackupFactory Bases: :py:obj:`factory.django.DjangoModelFactory` .. py:class:: Meta .. py:attribute:: model .. py:attribute:: name .. py:attribute:: archive_md5 .. py:attribute:: restoration_date .. py:attribute:: creation_date .. py:function:: md5_file_hash(file_path) A method generating MD5 hash of the provided file. :param file_path: file's path with an extension, which will be opened for reading and generating md5 hash :return: hex representation of md5 hash .. py:class:: Configuration Bases: :py:obj:`geonode.singleton.SingletonModel` A model used for managing the Geonode instance's global configuration, without a need for reloading the instance. Usage: from geonode.base.models import Configuration config = Configuration.load() .. py:attribute:: read_only .. py:attribute:: maintenance .. py:class:: Meta .. py:attribute:: verbose_name_plural :value: 'Configuration' .. py:method:: __str__() .. py:class:: RestoreCommandTests Bases: :py:obj:`geonode.tests.base.GeoNodeBaseTestSupport` .. py:method:: setUp() .. py:method:: test_with_logs_success(fake_confirm) .. py:method:: test_with_logs_failure(fake_confirm) .. py:method:: test_with_read_only_mode(mock_configuration_save, fake_confirm) .. py:method:: test_without_read_only_mode(mock_configuration_save, fake_confirm) .. py:method:: test_config_files(mock_configuration_save, fake_confirm) .. py:class:: GeoNodeBaseTestSupport Bases: :py:obj:`django.test.testcases.TestCase` .. py:attribute:: type :value: None .. py:attribute:: obj_ids :value: [] .. py:attribute:: integration :value: False .. py:attribute:: fixtures :value: ['initial_data.json', 'group_test_data.json', 'default_oauth_apps.json'] .. py:method:: get_obj_ids() .. py:method:: get_integration() .. py:method:: get_type() .. py:method:: setUp() .. py:class:: RestoredBackupFactory Bases: :py:obj:`factory.django.DjangoModelFactory` .. py:class:: Meta .. py:attribute:: model .. py:attribute:: name .. py:attribute:: archive_md5 .. py:attribute:: restoration_date .. py:attribute:: creation_date .. py:function:: md5_file_hash(file_path) A method generating MD5 hash of the provided file. :param file_path: file's path with an extension, which will be opened for reading and generating md5 hash :return: hex representation of md5 hash .. py:class:: RestoreCommand Bases: :py:obj:`django.core.management.base.BaseCommand` .. py:attribute:: help :value: 'Restore the GeoNode application data' .. py:method:: add_arguments(parser) .. py:method:: handle(**options) .. py:method:: execute_restore(**options) .. py:method:: validate_backup_file_options(**options) -> None Method validating --backup-file and --backup-files-dir options :param options: self.handle() method options :raises: Django CommandError, if options violate requirements :return: None .. py:method:: parse_backup_files_dir(backup_files_dir: str) -> Union[str, None] Method picking the Backup Archive to be restored from the Backup Files Directory. Only archives created/modified AFTER the last restored dumps are considered. :param backup_files_dir: path to the directory containing backup files :return: backup file path, if a proper backup archive was found, and None otherwise .. py:method:: validate_backup_file_hash(backup_file: str) -> str Method calculating the hash of the backup file and validating it if the proper \*.md5 file exists in the backup_file directory. :param backup_file: path to the backup_file :return: backup_file hash .. py:method:: check_backup_ini_settings(backup_file: str) -> str Method checking backup file's original settings availability :param backup_file: path to the backup_file :return: backup_ini_file_path original settings used by the backup file .. py:method:: restore_geoserver_backup(config, settings, target_folder, skip_geoserver_info, skip_geoserver_security, ignore_errors, soft_reset) Restore GeoServer Catalog .. py:method:: prepare_geoserver_gwc_config(config, settings) .. py:method:: restore_geoserver_raster_data(config, settings, target_folder) .. py:method:: restore_geoserver_vector_data(config, settings, target_folder, soft_reset) Restore Vectorial Data from DB .. py:method:: restore_geoserver_externals(config, settings, target_folder) Restore external references from XML files .. py:class:: RestoreCommandHelpersTests Bases: :py:obj:`geonode.tests.base.GeoNodeBaseTestSupport` Validate_backup_file_hash Validate_backup_file_options() method test .. py:method:: test_mandatory_option_failure() .. py:method:: test_exclusive_option_failure() .. py:method:: test_mandatory_option_backup_file_success() .. py:method:: test_mandatory_option_backup_file_failure() .. py:method:: test_mandatory_option_backup_files_dir_success() .. py:method:: test_mandatory_option_backup_files_dir_failure() .. py:method:: test_backup_files_dir_no_archive() .. py:method:: test_backup_files_dir_multiple_archives() .. py:method:: test_backup_files_dir_with_newer_restored_backup() .. py:method:: test_backup_files_dir_with_older_restored_backup() .. py:method:: test_backup_hash_no_md5_file() .. py:method:: test_backup_hash_failure() .. py:method:: test_backup_hash_success() .. py:class:: GeoNodeBaseTestSupport Bases: :py:obj:`django.test.testcases.TestCase` .. py:attribute:: type :value: None .. py:attribute:: obj_ids :value: [] .. py:attribute:: integration :value: False .. py:attribute:: fixtures :value: ['initial_data.json', 'group_test_data.json', 'default_oauth_apps.json'] .. py:method:: get_obj_ids() .. py:method:: get_integration() .. py:method:: get_type() .. py:method:: setUp() .. py:class:: Configuration Bases: :py:obj:`geonode.singleton.SingletonModel` A model used for managing the Geonode instance's global configuration, without a need for reloading the instance. Usage: from geonode.base.models import Configuration config = Configuration.load() .. py:attribute:: read_only .. py:attribute:: maintenance .. py:class:: Meta .. py:attribute:: verbose_name_plural :value: 'Configuration' .. py:method:: __str__() .. py:class:: BackupCommandTests Bases: :py:obj:`geonode.tests.base.GeoNodeBaseTestSupport` .. py:method:: setUp() .. py:method:: test_with_read_only_mode(mock_configuration_save, fake_confirm) .. py:method:: test_without_read_only_mode(mock_configuration_save, fake_confirm) .. py:method:: test_config_file_not_provided(mock_configuration_save, fake_confirm) .. py:method:: test_config_file_does_not_exist(mock_configuration_save, fake_confirm)