aiida.backends.tests.manage.backup package

Submodules

Tests for the Backup classes.

class aiida.backends.tests.manage.backup.test_backup_script.TestBackupScriptIntegration(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Integration tests for the Backup classes.

__module__ = 'aiida.backends.tests.manage.backup.test_backup_script'
_aiida_rel_path = '.aiida'
_backup_rel_path = 'backup'
_bs_instance = <aiida.manage.backup.backup_setup.BackupSetup object>
_repo_rel_path = 'repository'
create_backup_scripts(tmp_folder)[source]

Utility function to create backup scripts

fill_repo()[source]

Utility function to create repository nodes

test_integration()[source]

Test integration

class aiida.backends.tests.manage.backup.test_backup_script.TestBackupScriptUnit(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Unit tests of the Backup classes.

__module__ = 'aiida.backends.tests.manage.backup.test_backup_script'
_json_test_input_1 = '{"backup_length_threshold": 2, "periodicity": 2, "oldest_object_backedup": "2014-07-18 13:54:53.688484+00:00", "end_date_of_backup": null, "days_to_backup": null, "backup_dir": "/scratch/aiida_user/backupScriptDest"}'
_json_test_input_2 = '{"backup_length_threshold": 2, "periodicity": 2, "oldest_object_backedup": "2014-07-18 13:54:53.688484+00:00", "end_date_of_backup": null, "days_to_backup": null, "backup_dir": "/scratch/aiida_user/backupScriptDest"}'
_json_test_input_3 = '{"backup_length_threshold": 2, "periodicity": 2, "oldest_object_backedup": "2014-07-18 13:54:53.688484+00:00", "end_date_of_backup": null, "days_to_backup": 2, "backup_dir": "/scratch/aiida_user/backupScriptDest"}'
_json_test_input_4 = '{"backup_length_threshold": 2, "periodicity": 2, "oldest_object_backedup": "2014-07-18 13:54:53.688484+00:00", "end_date_of_backup": "2014-07-22 14:54:53.688484+00:00", "days_to_backup": null, "backup_dir": "/scratch/aiida_user/backupScriptDest"}'
_json_test_input_5 = '{"backup_length_threshold": 2, "periodicity": 2, "oldest_object_backedup": "2014-07-18 13:54:53.688484+00:00", "end_date_of_backup": "2014-07-22 14:54:53.688484+00:00", "days_to_backup": 2, "backup_dir": "/scratch/aiida_user/backup"}'
_json_test_input_6 = '{"backup_length_threshold": 2, "periodicity": 2, "oldest_object_backedup": "2014-07-18 13:54:53.688484", "end_date_of_backup": "2014-07-22 14:54:53.688484", "days_to_backup": null, "backup_dir": "/scratch/./aiida_user////backup//"}'
check_full_deserialization_serialization(input_string, backup_inst)[source]

Utility function to compare input string with content from Backup classes.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_full_deserialization_serialization_1()[source]

This method tests the correct deserialization / serialization of the variables that should be stored in a file.

test_full_deserialization_serialization_2()[source]

This method tests the correct deserialization / serialization of the variables that should be stored in a file.

test_full_deserialization_serialization_3()[source]

This method tests the correct deserialization / serialization of the variables that should be stored in a file.

test_full_deserialization_serialization_4()[source]

This method tests the correct deserialization / serialization of the variables that should be stored in a file.

test_loading_backup_time_params_from_file_1()[source]

This method tests that the _backup_setup_inst limits are correctly loaded from the JSON string and are correctly set.

In the parsed JSON string, no _backup_setup_inst end limits are set

test_loading_backup_time_params_from_file_2()[source]

This method tests that the _backup_setup_inst limits are correctly loaded from the JSON string and are correctly set.

In the parsed JSON string, only the daysToBackup limit is set.

test_loading_backup_time_params_from_file_3()[source]

This method tests that the _backup_setup_inst limits are correctly loaded from the JSON string and are correctly set.

In the parsed JSON string, only the endDateOfBackup limit is set.

test_loading_backup_time_params_from_file_4()[source]

This method tests that the _backup_setup_inst limits are correctly loaded from the JSON string and are correctly set.

In the parsed JSON string, the endDateOfBackup & daysToBackuplimit are set which should lead to an exception.

test_loading_basic_params_from_file()[source]

This method tests the correct loading of the basic _backup_setup_inst parameters from a JSON string.

test_timezone_addition_and_dir_correction()[source]

This method tests if the timezone is added correctly to timestamps that don’t have a timezone. Moreover, it checks if the given directory paths are normalized as expected.

Tests for the backup setup script.

class aiida.backends.tests.manage.backup.test_backup_setup_script.TestBackupSetupScriptIntegration(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test all of the backup setup script.

__module__ = 'aiida.backends.tests.manage.backup.test_backup_setup_script'
test_full_backup_setup_script()[source]

This method is a full test of the backup setup script. It launches it, replies to all the question as the user would do and in the end it checks that the correct files were created with the right content.

class aiida.backends.tests.manage.backup.test_backup_setup_script.TestBackupSetupScriptUnit(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test construction of the backup setup script

__module__ = 'aiida.backends.tests.manage.backup.test_backup_setup_script'
tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_construct_backup_variables()[source]

Test that checks that the backup variables are populated as it should by the construct_backup_variables by asking the needed questions. A lambda function is used to simulate the user input.