geonode.br.tests

Submodules

Classes

GeoNodeBaseTestSupport

RestoredBackupFactory

Configuration

A model used for managing the Geonode instance's global configuration, without a need for reloading the instance.

RestoreCommandTests

GeoNodeBaseTestSupport

RestoredBackupFactory

RestoreCommand

RestoreCommandHelpersTests

Validate_backup_file_hash

GeoNodeBaseTestSupport

Configuration

A model used for managing the Geonode instance's global configuration, without a need for reloading the instance.

BackupCommandTests

Functions

md5_file_hash(file_path)

A method generating MD5 hash of the provided file.

md5_file_hash(file_path)

A method generating MD5 hash of the provided file.

Package Contents

class geonode.br.tests.GeoNodeBaseTestSupport[source]

Bases: django.test.testcases.TestCase

type = None
obj_ids = []
integration = False
fixtures = ['initial_data.json', 'group_test_data.json', 'default_oauth_apps.json']
get_obj_ids()[source]
get_integration()[source]
get_type()[source]
setUp()[source]
class geonode.br.tests.RestoredBackupFactory[source]

Bases: factory.django.DjangoModelFactory

class Meta
model
name
archive_md5
restoration_date
creation_date
geonode.br.tests.md5_file_hash(file_path)[source]

A method generating MD5 hash of the provided file.

Parameters:

file_path – file’s path with an extension, which will be opened for reading and generating md5 hash

Returns:

hex representation of md5 hash

class geonode.br.tests.Configuration[source]

Bases: 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()

read_only
maintenance
class Meta
verbose_name_plural = 'Configuration'
__str__()[source]
class geonode.br.tests.RestoreCommandTests[source]

Bases: geonode.tests.base.GeoNodeBaseTestSupport

setUp()[source]
test_with_logs_success(fake_confirm)[source]
test_with_logs_failure(fake_confirm)[source]
test_with_read_only_mode(mock_configuration_save, fake_confirm)[source]
test_without_read_only_mode(mock_configuration_save, fake_confirm)[source]
test_config_files(mock_configuration_save, fake_confirm)[source]
class geonode.br.tests.GeoNodeBaseTestSupport[source]

Bases: django.test.testcases.TestCase

type = None
obj_ids = []
integration = False
fixtures = ['initial_data.json', 'group_test_data.json', 'default_oauth_apps.json']
get_obj_ids()[source]
get_integration()[source]
get_type()[source]
setUp()[source]
class geonode.br.tests.RestoredBackupFactory[source]

Bases: factory.django.DjangoModelFactory

class Meta
model
name
archive_md5
restoration_date
creation_date
geonode.br.tests.md5_file_hash(file_path)[source]

A method generating MD5 hash of the provided file.

Parameters:

file_path – file’s path with an extension, which will be opened for reading and generating md5 hash

Returns:

hex representation of md5 hash

class geonode.br.tests.RestoreCommand

Bases: django.core.management.base.BaseCommand

help = 'Restore the GeoNode application data'
add_arguments(parser)
handle(**options)
execute_restore(**options)
validate_backup_file_options(**options) None

Method validating –backup-file and –backup-files-dir options

Parameters:

options – self.handle() method options

Raises:

Django CommandError, if options violate requirements

Returns:

None

parse_backup_files_dir(backup_files_dir: str) 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.

Parameters:

backup_files_dir – path to the directory containing backup files

Returns:

backup file path, if a proper backup archive was found, and None otherwise

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.

Parameters:

backup_file – path to the backup_file

Returns:

backup_file hash

check_backup_ini_settings(backup_file: str) str

Method checking backup file’s original settings availability

Parameters:

backup_file – path to the backup_file

Returns:

backup_ini_file_path original settings used by the backup file

restore_geoserver_backup(config, settings, target_folder, skip_geoserver_info, skip_geoserver_security, ignore_errors, soft_reset)

Restore GeoServer Catalog

prepare_geoserver_gwc_config(config, settings)
restore_geoserver_raster_data(config, settings, target_folder)
restore_geoserver_vector_data(config, settings, target_folder, soft_reset)

Restore Vectorial Data from DB

restore_geoserver_externals(config, settings, target_folder)

Restore external references from XML files

class geonode.br.tests.RestoreCommandHelpersTests[source]

Bases: geonode.tests.base.GeoNodeBaseTestSupport

Validate_backup_file_hash

Validate_backup_file_options() method test

test_mandatory_option_failure()[source]
test_exclusive_option_failure()[source]
test_mandatory_option_backup_file_success()[source]
test_mandatory_option_backup_file_failure()[source]
test_mandatory_option_backup_files_dir_success()[source]
test_mandatory_option_backup_files_dir_failure()[source]
test_backup_files_dir_no_archive()[source]
test_backup_files_dir_multiple_archives()[source]
test_backup_files_dir_with_newer_restored_backup()[source]
test_backup_files_dir_with_older_restored_backup()[source]
test_backup_hash_no_md5_file()[source]
test_backup_hash_failure()[source]
test_backup_hash_success()[source]
class geonode.br.tests.GeoNodeBaseTestSupport[source]

Bases: django.test.testcases.TestCase

type = None
obj_ids = []
integration = False
fixtures = ['initial_data.json', 'group_test_data.json', 'default_oauth_apps.json']
get_obj_ids()[source]
get_integration()[source]
get_type()[source]
setUp()[source]
class geonode.br.tests.Configuration[source]

Bases: 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()

read_only
maintenance
class Meta
verbose_name_plural = 'Configuration'
__str__()[source]
class geonode.br.tests.BackupCommandTests[source]

Bases: geonode.tests.base.GeoNodeBaseTestSupport

setUp()[source]
test_with_read_only_mode(mock_configuration_save, fake_confirm)[source]
test_without_read_only_mode(mock_configuration_save, fake_confirm)[source]
test_config_file_not_provided(mock_configuration_save, fake_confirm)[source]
test_config_file_does_not_exist(mock_configuration_save, fake_confirm)[source]